fix(widgets): refresh model assets and skip output refresh on asset-mode dropdown open (FE-732 fix)#12465
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
🎨 Storybook: ✅ Built — View Storybook |
🎭 Playwright: ❌ 1357 passed, 130 failed❌ Failed Tests📊 Browser Reports
|
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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…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
62fcbe5 to
9792924
Compare
4acd50c
into
jaewon/fe-732-l15-l1-ui-surfaces-remove-iscloud-guards-filter-modal-3
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
FormDropdownasset path; this PR fixes both.Symptoms (verified via CDP against
pr-3809.testenvs.comfy.orgcloud BE and a localsynap5e/assets-m1 --enable-assetsOSS BE)Reported by Simon in #m1-fe-integration testing against PR #12411:
rto 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./api/jobsper dropdown open — each model dropdown open hits/api/jobs?status=completed,failed,cancelled&limit=200&offset=0for 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; onceassetsStore.hasAssetKey(...)returns true, the watch short-circuits forever. Dropdown reopen has no refresh hook.WidgetSelectDropdown.handleIsOpenUpdatecallsoutputMediaAssets.refresh()on every open regardless of widget kind. For asset-mode (model) dropdowns this is irrelevant — but the call still routes throughuseAssetsApi('output')→assetsStore.updateHistory→api.getHistory→/jobs?status=completed,failed,cancelledon OSS. Cloud distribution swaps the provider foruseFlatOutputAssetswhich 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)inuseAssetWidgetData.Fix
useAssetWidgetData: exposerefresh()that re-invokesassetsStore.updateModelsForNodeTypefor the current node type, guarded against re-entry while a fetch is in flight.WidgetSelectDropdown.handleIsOpenUpdate: branch onprops.isAssetMode— asset-mode dropdowns refresh model assets viaassetData.refresh(); non-asset-mode dropdowns continue to refreshoutputMediaAssetsas before (preserved cloud / OSS behavior).Verification
CDP — Vue Nodes 2.0 ON
Same dropdown opened twice (
qwen_image_vaeVAELoader widget):/api/jobs?status=.../api/assets?include_tags=models,vaeBefore the fix (same setup): 1st open fired both
/api/jobsand the model fetch; 2nd open fired only/api/jobs(model list stale).Other paths preserved (verified empirically + by code):
/api/jobsstill fires (existing OSS behavior)./api/assets?include_tags=outputstill fires (existing cloud behavior; branch inWidgetSelectDropdown.vueoutputMediaAssets ternary is untouched).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 forrefresh()).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 typecheckclean.m1-fe-integrationonce 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…