mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 07:44:11 +00:00
[bugfix] Fix node replacements not loading due to feature flag timing (#9037)
## Summary - Node replacements were never loaded because `useNodeReplacementStore().load()` was called before `api.init()`, meaning `serverFeatureFlags` was always empty at that point - Dispatch `feature_flags` as a custom event from `api.ts` and trigger `load()` in response within `addApiUpdateHandlers()` ## Changes - **`api.ts`**: Dispatch `feature_flags` custom event after storing server feature flags (already typed in `BackendApiCalls`) - **`app.ts`**: Replace eager `load()` call with `feature_flags` event listener inside `addApiUpdateHandlers()`, consistent with other API event handlers - **`nodeReplacementStore.ts`**: Use `api.getServerFeature()` directly instead of `useFeatureFlags` composable; remove side effects from store setup - **`nodeReplacementStore.test.ts`**: Update mocks to match new `api.getServerFeature` usage ## Review Focus - Initialization ordering: listener registered before `api.init()` ensures no missed events ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9037-bugfix-Fix-node-replacements-not-loading-due-to-feature-flag-timing-30e6d73d36508107ae2cd72e83c01e1a) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -739,6 +739,10 @@ export class ComfyApp {
|
||||
releaseSharedObjectUrl(blobUrl)
|
||||
})
|
||||
|
||||
api.addEventListener('feature_flags', () => {
|
||||
void useNodeReplacementStore().load()
|
||||
})
|
||||
|
||||
api.init()
|
||||
}
|
||||
|
||||
@@ -802,7 +806,6 @@ export class ComfyApp {
|
||||
await useWorkspaceStore().workflow.syncWorkflows()
|
||||
//Doesn't need to block. Blueprints will load async
|
||||
void useSubgraphStore().fetchSubgraphs()
|
||||
await useNodeReplacementStore().load()
|
||||
await useExtensionService().loadExtensions()
|
||||
|
||||
this.addProcessKeyHandler()
|
||||
|
||||
Reference in New Issue
Block a user