From 14369c08a3a9b871059b940d8b902ceff85eb2c8 Mon Sep 17 00:00:00 2001 From: Alexander Brown Date: Tue, 27 Jan 2026 12:50:13 -0800 Subject: [PATCH] refactor: parallelize bootstrap and simplify lifecycle with VueUse (#8307) ## Summary Refactors bootstrap and lifecycle management to parallelize initialization, use Vue best practices, and fix a logout state bug. ## Changes ### Bootstrap Store (`bootstrapStore.ts`) - Extract early bootstrap logic into a dedicated store using `useAsyncState` - Parallelize settings, i18n, and workflow sync loading (previously sequential) - Handle multi-user login scenarios by deferring settings/workflows until authenticated ### GraphCanvas Refactoring - Move non-DOM composables (`useGlobalLitegraph`, `useCopy`, `usePaste`, etc.) to script setup level for earlier initialization - Move `watch` and `whenever` declarations outside `onMounted` (Vue best practice) - Use `until()` from VueUse to await bootstrap store readiness instead of direct async calls ### GraphView Simplification - Replace manual `addEventListener`/`removeEventListener` with `useEventListener` - Replace `setInterval` with `useIntervalFn` for automatic cleanup - Move core command registration to script setup level ### Bug Fix Using `router.push()` for logout caused `isSettingsReady` to persist as `true`, making new users inherit the previous user's cached settings. Reverted to `window.location.reload()` with TODOs for future store reset implementation. ## Testing - Verified login/logout cycle clears settings correctly - Verified bootstrap sequence completes without errors --------- Co-authored-by: Amp --- AGENTS.md | 6 + .../tests/versionMismatchWarnings.spec.ts | 4 + src/AGENTS.md | 1 + src/App.vue | 9 +- src/components/graph/GraphCanvas.vue | 111 ++++++++++------- src/composables/node/useNodeBadge.ts | 3 + src/composables/useCoreCommands.test.ts | 15 ++- src/composables/useCoreCommands.ts | 3 +- src/main.ts | 5 + .../composables/useSubscription.ts | 4 + src/platform/settings/settingStore.test.ts | 34 ++++-- src/platform/settings/settingStore.ts | 62 +++++++--- .../management/stores/workflowStore.ts | 98 +++++++++------ .../composables/useMinimapGraph.test.ts | 12 +- .../minimap/composables/useMinimapGraph.ts | 4 +- src/stores/bootstrapStore.test.ts | 115 ++++++++++++++++++ src/stores/bootstrapStore.ts | 54 ++++++++ src/stores/workspaceStore.ts | 3 +- src/views/GraphView.vue | 66 +++------- 19 files changed, 422 insertions(+), 187 deletions(-) create mode 100644 src/stores/bootstrapStore.test.ts create mode 100644 src/stores/bootstrapStore.ts diff --git a/AGENTS.md b/AGENTS.md index 9938865a9..4659d0761 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -300,6 +300,12 @@ When referencing Comfy-Org repos: Rules for agent-based coding tasks. +### Chrome DevTools MCP + +When using `take_snapshot` to inspect dropdowns, listboxes, or other components with dynamic options: +- Use `verbose: true` to see the full accessibility tree including list items +- Non-verbose snapshots often omit nested options in comboboxes/listboxes + ### Temporary Files - Put planning documents under `/temp/plans/` diff --git a/browser_tests/tests/versionMismatchWarnings.spec.ts b/browser_tests/tests/versionMismatchWarnings.spec.ts index 4b3ff3e30..223770b12 100644 --- a/browser_tests/tests/versionMismatchWarnings.spec.ts +++ b/browser_tests/tests/versionMismatchWarnings.spec.ts @@ -38,6 +38,10 @@ test.describe('Version Mismatch Warnings', () => { test.beforeEach(async ({ comfyPage }) => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') + await comfyPage.setSetting( + 'Comfy.VersionCompatibility.DisableWarnings', + false + ) }) test('should show version mismatch warnings when installed version lower than required', async ({ diff --git a/src/AGENTS.md b/src/AGENTS.md index 2778d1b25..276948254 100644 --- a/src/AGENTS.md +++ b/src/AGENTS.md @@ -17,6 +17,7 @@ - Clear public interfaces - Restrict extension access - Clean up subscriptions +- Only expose state/actions that are used externally; keep internal state private ## General Guidelines diff --git a/src/App.vue b/src/App.vue index c3a879b17..7c11c4c7b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,7 +10,6 @@