Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion browser_tests/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/platform/settings/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1116,5 +1116,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'
}
]
7 changes: 6 additions & 1 deletion src/platform/updates/common/versionCompatibilityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -12,6 +13,7 @@ export const useVersionCompatibilityStore = defineStore(
'versionCompatibility',
() => {
const systemStatsStore = useSystemStatsStore()
const settingStore = useSettingStore()

const frontendVersion = computed(() => config.app_version)
const backendVersion = computed(
Expand Down Expand Up @@ -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(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/schemas/apiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof zEmbeddingsResponse>
Expand Down
35 changes: 35 additions & 0 deletions tests-ui/tests/store/versionCompatibilityStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => ({
Expand All @@ -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<string, number>)
vi.mock('@vueuse/core', () => ({
Expand All @@ -23,6 +31,7 @@ vi.mock('@vueuse/core', () => ({
describe('useVersionCompatibilityStore', () => {
let store: ReturnType<typeof useVersionCompatibilityStore>
let mockSystemStatsStore: any
let mockSettingStore: any

beforeEach(() => {
setActivePinia(createPinia())
Expand All @@ -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()
})
Expand Down Expand Up @@ -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', () => {
Expand Down
Loading