diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index bf1a219e6..9c1ebeb7a 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -1651,7 +1651,10 @@ export const comfyPageFixture = base.extend<{ // Set tutorial completed to true to avoid loading the tutorial workflow. 'Comfy.TutorialCompleted': true, 'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize, - 'Comfy.VueNodes.AutoScaleLayout': false + 'Comfy.VueNodes.AutoScaleLayout': false, + // Disable toast warning about version compatibility, as they may or + // may not appear - depending on upstream ComfyUI dependencies + 'Comfy.VersionCompatibility.DisableWarnings': true }) } catch (e) { console.error(e) diff --git a/src/platform/settings/constants/coreSettings.ts b/src/platform/settings/constants/coreSettings.ts index 7590c0f88..fb87ea133 100644 --- a/src/platform/settings/constants/coreSettings.ts +++ b/src/platform/settings/constants/coreSettings.ts @@ -1117,5 +1117,12 @@ export const CORE_SETTINGS: SettingParams[] = [ tooltip: 'Use new Asset API for model browsing', defaultValue: isCloud ? true : false, experimental: true + }, + { + id: 'Comfy.VersionCompatibility.DisableWarnings', + name: 'Disable version compatibility warnings', + type: 'hidden', + defaultValue: false, + versionAdded: '1.34.1' } ] diff --git a/src/platform/updates/common/versionCompatibilityStore.ts b/src/platform/updates/common/versionCompatibilityStore.ts index cc85f945b..f59cbc279 100644 --- a/src/platform/updates/common/versionCompatibilityStore.ts +++ b/src/platform/updates/common/versionCompatibilityStore.ts @@ -4,6 +4,7 @@ import { gt, valid } from 'semver' import { computed } from 'vue' import config from '@/config' +import { useSettingStore } from '@/platform/settings/settingStore' import { useSystemStatsStore } from '@/stores/systemStatsStore' const DISMISSAL_DURATION_MS = 7 * 24 * 60 * 60 * 1000 // 7 days @@ -12,6 +13,7 @@ export const useVersionCompatibilityStore = defineStore( 'versionCompatibility', () => { const systemStatsStore = useSystemStatsStore() + const settingStore = useSettingStore() const frontendVersion = computed(() => config.app_version) const backendVersion = computed( @@ -87,7 +89,10 @@ export const useVersionCompatibilityStore = defineStore( }) const shouldShowWarning = computed(() => { - return hasVersionMismatch.value && !isDismissed.value + const warningsDisabled = settingStore.get( + 'Comfy.VersionCompatibility.DisableWarnings' + ) + return hasVersionMismatch.value && !isDismissed.value && !warningsDisabled }) const warningMessage = computed(() => { diff --git a/src/schemas/apiSchema.ts b/src/schemas/apiSchema.ts index 653dbcf5d..5187145cf 100644 --- a/src/schemas/apiSchema.ts +++ b/src/schemas/apiSchema.ts @@ -523,7 +523,8 @@ const zSettings = z.object({ 'main.sub.setting.name': z.any(), 'single.setting': z.any(), 'LiteGraph.Node.DefaultPadding': z.boolean(), - 'LiteGraph.Pointer.TrackpadGestures': z.boolean() + 'LiteGraph.Pointer.TrackpadGestures': z.boolean(), + 'Comfy.VersionCompatibility.DisableWarnings': z.boolean() }) export type EmbeddingsResponse = z.infer diff --git a/tests-ui/tests/store/versionCompatibilityStore.test.ts b/tests-ui/tests/store/versionCompatibilityStore.test.ts index f77baf328..d6e9c15af 100644 --- a/tests-ui/tests/store/versionCompatibilityStore.test.ts +++ b/tests-ui/tests/store/versionCompatibilityStore.test.ts @@ -3,6 +3,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { ref } from 'vue' import { useVersionCompatibilityStore } from '@/platform/updates/common/versionCompatibilityStore' +import { useSettingStore } from '@/platform/settings/settingStore' import { useSystemStatsStore } from '@/stores/systemStatsStore' vi.mock('@/config', () => ({ @@ -13,6 +14,13 @@ vi.mock('@/config', () => ({ vi.mock('@/stores/systemStatsStore') +// Mock settingStore +vi.mock('@/platform/settings/settingStore', () => ({ + useSettingStore: vi.fn(() => ({ + get: vi.fn(() => false) // Default to warnings enabled (false = not disabled) + })) +})) + // Mock useStorage and until from VueUse const mockDismissalStorage = ref({} as Record) vi.mock('@vueuse/core', () => ({ @@ -23,6 +31,7 @@ vi.mock('@vueuse/core', () => ({ describe('useVersionCompatibilityStore', () => { let store: ReturnType let mockSystemStatsStore: any + let mockSettingStore: any beforeEach(() => { setActivePinia(createPinia()) @@ -36,7 +45,12 @@ describe('useVersionCompatibilityStore', () => { refetchSystemStats: vi.fn() } + mockSettingStore = { + get: vi.fn(() => false) // Default to warnings enabled + } + vi.mocked(useSystemStatsStore).mockReturnValue(mockSystemStatsStore) + vi.mocked(useSettingStore).mockReturnValue(mockSettingStore) store = useVersionCompatibilityStore() }) @@ -196,6 +210,27 @@ describe('useVersionCompatibilityStore', () => { expect(store.shouldShowWarning).toBe(false) }) + + it('should not show warning when disabled via setting', async () => { + // Enable the disable setting + mockSettingStore.get.mockReturnValue(true) + + // Set up version mismatch that would normally show warning + mockSystemStatsStore.systemStats = { + system: { + comfyui_version: '1.25.0', + required_frontend_version: '1.25.0' + } + } + mockSystemStatsStore.isInitialized = true + + await store.checkVersionCompatibility() + + expect(store.shouldShowWarning).toBe(false) + expect(mockSettingStore.get).toHaveBeenCalledWith( + 'Comfy.VersionCompatibility.DisableWarnings' + ) + }) }) describe('warning messages', () => {