Skip to content

fix(widgets): refresh model assets and skip output refresh on asset-mode dropdown open (FE-732 fix)#12465

Merged
dante01yoon merged 2 commits into
jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3from
jaewon/fix-asset-dropdown-refresh-on-open
May 26, 2026
Merged

fix(widgets): refresh model assets and skip output refresh on asset-mode dropdown open (FE-732 fix)#12465
dante01yoon merged 2 commits into
jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3from
jaewon/fix-asset-dropdown-refresh-on-open

Conversation

@dante01yoon
Copy link
Copy Markdown
Collaborator

@dante01yoon dante01yoon commented May 26, 2026

Screen.Recording.2026-05-27.at.12.41.56.AM.mov

Stacks on #12417 (FE-732). The isCloud guard removal in the M1 stack (FE-731/FE-732) exposed two latent regressions on the inline FormDropdown asset path; this PR fixes both.

Symptoms (verified via CDP against pr-3809.testenvs.comfy.org cloud BE and a local synap5e/assets-m1 --enable-assets OSS BE)

Reported by Simon in #m1-fe-integration testing against PR #12411:

  1. Model dropdown stale listr to refresh doesn't update the dropdown; the model list is fetched once on first dropdown open (/api/assets?include_tags=models,checkpoints&limit=500&exclude_tags=missing) and cached. Reopening shows stale data. Newly imported models don't appear until full page reload.
  2. /api/jobs per dropdown open — each model dropdown open hits /api/jobs?status=completed,failed,cancelled&limit=200&offset=0 for no reason. This is the OSS history path being triggered by the output-media refresh hook in the dropdown.

Root cause

  • useAssetWidgetData.watch(immediate:true) is the only trigger for model fetch; once assetsStore.hasAssetKey(...) returns true, the watch short-circuits forever. Dropdown reopen has no refresh hook.
  • WidgetSelectDropdown.handleIsOpenUpdate calls outputMediaAssets.refresh() on every open regardless of widget kind. For asset-mode (model) dropdowns this is irrelevant — but the call still routes through useAssetsApi('output')assetsStore.updateHistoryapi.getHistory/jobs?status=completed,failed,cancelled on OSS. Cloud distribution swaps the provider for useFlatOutputAssets which hits /api/assets?include_tags=output — still wasted work, just a different URL.

The handler and cache guard are pre-existing (#6734, #8090), but were only reachable from cloud distributions before FE-731 unwrapped if (isCloud) in useAssetWidgetData.

Fix

  • useAssetWidgetData: expose refresh() that re-invokes assetsStore.updateModelsForNodeType for the current node type, guarded against re-entry while a fetch is in flight.
  • WidgetSelectDropdown.handleIsOpenUpdate: branch on props.isAssetMode — asset-mode dropdowns refresh model assets via assetData.refresh(); non-asset-mode dropdowns continue to refresh outputMediaAssets as before (preserved cloud / OSS behavior).

Verification

CDP — Vue Nodes 2.0 ON

Same dropdown opened twice (qwen_image_vae VAELoader widget):

Open # /api/jobs?status=... /api/assets?include_tags=models,vae
1st 0 1 (fresh fetch)
2nd 0 1 (fresh fetch — newly added models would appear)

Before the fix (same setup): 1st open fired both /api/jobs and the model fetch; 2nd open fired only /api/jobs (model list stale).

Other paths preserved (verified empirically + by code):

  • OSS + non-asset-mode dropdown → /api/jobs still fires (existing OSS behavior).
  • Cloud + non-asset-mode dropdown → /api/assets?include_tags=output still fires (existing cloud behavior; branch in WidgetSelectDropdown.vue outputMediaAssets ternary is untouched).
  • WS-status queue/history polling (limit=64 /api/jobs) still fires on page load — unrelated to dropdown.

Test plan

  • pnpm vitest run src/renderer/extensions/vueNodes/widgets/composables/useAssetWidgetData.test.ts — 10/10 (3 new tests for refresh()).
  • pnpm vitest run src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.test.ts — 9/9 (4 new tests cover handleIsOpenUpdate branches: asset-mode skips outputMediaAssets.refresh, asset-mode reopen refetches model assets, non-asset-mode preserves outputMediaAssets.refresh, close event is no-op).
  • pnpm typecheck clean.
  • Re-test in m1-fe-integration once stacked PRs merge: import a new model via cloud import flow → reopen dropdown → new model appears without page reload.

Uploading Screen Recording 2026-05-27 at 12.43.13 AM.mov…

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 26, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b55565ba-3d7d-4f9c-8239-38d755c87968

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jaewon/fix-asset-dropdown-refresh-on-open

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 05/26/2026, 03:54:18 PM UTC

Links

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

🎭 Playwright: ❌ 1357 passed, 130 failed

❌ Failed Tests

📊 Browser Reports

@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                                           Coverage Diff                                           @@
##           jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3   #12465    +/-   ##
=======================================================================================================
  Coverage                                                                  59.86%   59.87%            
=======================================================================================================
  Files                                                                       1411     1411            
  Lines                                                                      72046    72055     +9     
  Branches                                                                   19057    19987   +930     
=======================================================================================================
+ Hits                                                                       43129    43141    +12     
+ Misses                                                                     28444    28441     -3     
  Partials                                                                     473      473            
Flag Coverage Δ
unit 59.87% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...eNodes/widgets/components/WidgetSelectDropdown.vue 64.17% <100.00%> (+7.03%) ⬆️
...vueNodes/widgets/composables/useAssetWidgetData.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dante01yoon dante01yoon changed the base branch from jaewon/fe-731-l14-l1-widgets-remove-iscloud-guards-in-usecombowidget to jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3 May 26, 2026 15:52
…ode dropdown open

Two regressions surfaced after FE-731 unwrapped the isCloud guard in
useAssetWidgetData, exposing the inline FormDropdown asset path to all
distributions:

1. Model dropdown stale: useAssetWidgetData.watch fetches once on mount
   then never again, so reopening the dropdown shows a stale list and
   newly imported models do not appear until full page reload.
2. /api/jobs side-call on every open: handleIsOpenUpdate unconditionally
   refreshes outputMediaAssets even for asset-mode (model) dropdowns,
   triggering /api/jobs (OSS path) or /api/assets?include_tags=output
   (cloud path) on every open with no relevance to the model picker.

Fix:
- useAssetWidgetData: expose refresh() that re-invokes
  assetsStore.updateModelsForNodeType, guarded against re-entry while a
  fetch is already in flight.
- WidgetSelectDropdown.handleIsOpenUpdate: branch on isAssetMode -
  asset-mode dropdowns refresh model assets, others refresh output
  media (existing behavior).
Component-level regression tests for the WidgetSelectDropdown
handleIsOpenUpdate fix:

- asset-mode dropdown open does NOT call outputMediaAssets.refresh
  (skips /api/jobs on OSS path and /api/assets?include_tags=output
  on cloud path - provider-agnostic guarantee)
- asset-mode dropdown reopen calls assetData.refresh each time
  (no stale model list across opens)
- non-asset-mode dropdown open still calls outputMediaAssets.refresh
  (preserved behavior for image/video picker widgets)
- close event (isOpen=false) is a no-op
@dante01yoon dante01yoon force-pushed the jaewon/fix-asset-dropdown-refresh-on-open branch from 62fcbe5 to 9792924 Compare May 26, 2026 15:52
@dante01yoon dante01yoon changed the title fix(widgets): refresh model assets and skip output refresh on asset-mode dropdown open fix(widgets): refresh model assets and skip output refresh on asset-mode dropdown open (FE-732 fix) May 26, 2026
@dante01yoon dante01yoon merged commit 4acd50c into jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3 May 26, 2026
31 of 42 checks passed
@dante01yoon dante01yoon deleted the jaewon/fix-asset-dropdown-refresh-on-open branch May 26, 2026 15:59
dante01yoon added a commit that referenced this pull request May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant