Skip to content

Restore the previously selected remote value in useRemoteWidget after reload #17411

Description

@coderabbitai

Summary

useRemoteWidget does not restore the previously selected value after an application or workflow reload. The widget selects the first available remote value instead.

LoadImageOutput uses useRemoteWidget. This behavior causes its image selection to change after reload.

Required changes

Update the selected-value restoration logic in useRemoteWidget so it preserves the saved value when that value is present in the refreshed remote options. Select a fallback value only when the saved value is unavailable.

Rationale

A reload must not silently change the value that the user selected. The current behavior also makes workflow persistence tests depend on the remote option order.

Affected areas

  • useRemoteWidget
  • LoadImageOutput
  • Tests for remote widget value restoration and output image selection

Acceptance criteria

  • After reload, useRemoteWidget restores the previously selected value when it exists in the remote options.
  • LoadImageOutput keeps its selected output image after reload.
  • The implementation selects a fallback only if the saved value is absent.
  • Tests cover a remote option response where the saved value is not the first item.

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions