Comfy-Org / Comfy-Org/ComfyUI_frontend

Restore the previously selected remote value in useRemoteWidget after reload

Closed
#17,411 0 comments 0 reactions 1 assignee Claimed by @jaeone94 View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## 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

- Reported by @jaeone94.
- Follow-up from PR #17239.
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17239#discussion_r3984967305

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.