From cc73c42f7607f91b7f397ee7ec9abd084397b973 Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Tue, 21 Oct 2025 14:08:36 -0700 Subject: [PATCH] Fix circular dependency in setting registration (#6184) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Comfy.Canvas.NavigationMode` and `Comfy.Canvas.LeftMouseClickBehavior` introduce a circular dependency where setting the value of one will set the value of the other. This is solved by having `NavigationMode` skip changing other settings when `oldValue` is undefined. - Note that `oldValue` is only undefined during initial load. When a user changes the value for the first time, oldValue will be the default value. In the unlikely event desync occurs (a user manually editing the backing json?), the registration of the subsequent `LeftMouseClickBehavior` will still correct `NavigationMode` back to custom ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6184-Fix-circular-dependency-in-setting-registration-2936d73d365081809aa5d8bff0bf2333) by [Unito](https://www.unito.io) --- src/components/graph/GraphCanvas.vue | 4 +--- src/platform/settings/constants/coreSettings.ts | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index b59f15ebe..ea052d34a 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -420,9 +420,7 @@ onMounted(async () => { throw error } } - CORE_SETTINGS.forEach((setting) => { - settingStore.addSetting(setting) - }) + CORE_SETTINGS.forEach(settingStore.addSetting) await newUserService().initializeIfNewUser(settingStore) diff --git a/src/platform/settings/constants/coreSettings.ts b/src/platform/settings/constants/coreSettings.ts index 1ec09903f..916d2e8fa 100644 --- a/src/platform/settings/constants/coreSettings.ts +++ b/src/platform/settings/constants/coreSettings.ts @@ -163,7 +163,8 @@ export const CORE_SETTINGS: SettingParams[] = [ defaultsByInstallVersion: { '1.25.0': 'legacy' }, - onChange: async (newValue: string) => { + onChange: async (newValue: string, oldValue?: string) => { + if (!oldValue) return const settingStore = useSettingStore() if (newValue === 'standard') {