diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 8ef41fb34..1a85b4efb 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -302,6 +302,17 @@ onMounted(async () => { CORE_SETTINGS.forEach((setting) => { settingStore.addSetting(setting) }) + + // to determine if the user is "new user" or not, we check if the settingValues is empty. only it is empty, we set Comfy.InstalledVersion. + // more info: user settings are loaded in the BE folder ComfyUI/user/default/comfy.settings.json and new instance of ComfyUI will have no settings. + // if this settings file is not empty, it means the user has already used ComfyUI before, and we should not set the Comfy.InstalledVersion, according to https://github.com/Comfy-Org/ComfyUI_frontend/issues/4073 + if (Object.keys(settingStore.settingValues).length == 0) { + await settingStore.set( + 'Comfy.InstalledVersion', + __COMFYUI_FRONTEND_VERSION__ + ) + } + // @ts-expect-error fixme ts strict error await comfyApp.setup(canvasRef.value) canvasStore.canvas = comfyApp.canvas diff --git a/src/constants/coreSettings.ts b/src/constants/coreSettings.ts index 295ea01fd..ee884ef68 100644 --- a/src/constants/coreSettings.ts +++ b/src/constants/coreSettings.ts @@ -747,6 +747,13 @@ export const CORE_SETTINGS: SettingParams[] = [ defaultValue: false, versionAdded: '1.8.7' }, + { + id: 'Comfy.InstalledVersion', + name: 'Installed frontend version', + type: 'hidden', + defaultValue: null, + versionAdded: '1.24.0' + }, { id: 'LiteGraph.ContextMenu.Scaling', name: 'Scale node combo widget menus (lists) when zoomed in', diff --git a/src/schemas/apiSchema.ts b/src/schemas/apiSchema.ts index da637612e..db55f61f0 100644 --- a/src/schemas/apiSchema.ts +++ b/src/schemas/apiSchema.ts @@ -451,6 +451,7 @@ const zSettings = z.object({ 'Comfy.Toast.DisableReconnectingToast': z.boolean(), 'Comfy.Workflow.Persist': z.boolean(), 'Comfy.TutorialCompleted': z.boolean(), + 'Comfy.InstalledVersion': z.string().nullable(), 'Comfy.Node.AllowImageSizeDraw': z.boolean(), 'Comfy-Desktop.AutoUpdate': z.boolean(), 'Comfy-Desktop.SendStatistics': z.boolean(),