-
Notifications
You must be signed in to change notification settings - Fork 364
Feature Implemented: Warning displayed when frontend version mismatches #4363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
christian-byrne
merged 13 commits into
Comfy-Org:main
from
shivansh-gupta4:warning-when-frontend-version-mismatches
Jul 29, 2025
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
54b7fa3
Feature Implemented: Warning displayed when frontend version mismatches
shivansh-gupta4 e131621
Created a computed for generating current_version_key and added semve…
shivansh-gupta4 abe5c94
Merge branch 'main' into warning-when-frontend-version-mismatches
shivansh-gupta4 4f336f7
Corrected the Eslint and Prettier errors
shivansh-gupta4 561bb00
Corrected persisting logic in versioncompatibility store, corrected p…
shivansh-gupta4 6a36557
Update VersionMismatchWarning.vue
shivansh-gupta4 4c61579
[fix] Improve version mismatch warning system with automatic dismissa…
christian-byrne dcfe11e
[improve] Implement feedback improvements for version mismatch warnin…
christian-byrne 02b85e1
[refactor] Improve localStorage organization and fix test mocking
christian-byrne 1ad0aa7
[bugfix] Fix version mismatch warning logic to use semver library
christian-byrne ad5500e
[bugfix] Simplify version warning logic to only warn when outdated
christian-byrne aee5f8f
add browser test
christian-byrne 770b49d
[cleanup] Remove unused version mismatch dismissal setting and unnece…
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<template> | ||
<Message | ||
v-if="versionStore.shouldShowWarning" | ||
severity="warn" | ||
icon="pi pi-exclamation-triangle" | ||
class="my-2 mx-2" | ||
:closable="true" | ||
:pt="{ | ||
root: { class: 'flex-col' }, | ||
text: { class: 'flex-1' } | ||
}" | ||
@close="handleDismiss" | ||
> | ||
<div class="flex flex-col gap-3"> | ||
<!-- Warning Message --> | ||
<div class="font-medium"> | ||
{{ $t('versionMismatchWarning.title') }} | ||
</div> | ||
|
||
<!-- Version Details --> | ||
<div v-if="versionStore.warningMessage"> | ||
<div v-if="versionStore.warningMessage.type === 'outdated'"> | ||
{{ | ||
$t('versionMismatchWarning.frontendOutdated', { | ||
frontendVersion: versionStore.warningMessage.frontendVersion, | ||
requiredVersion: versionStore.warningMessage.requiredVersion | ||
}) | ||
}} | ||
</div> | ||
<div v-else-if="versionStore.warningMessage.type === 'newer'"> | ||
{{ | ||
$t('versionMismatchWarning.frontendNewer', { | ||
frontendVersion: versionStore.warningMessage.frontendVersion, | ||
backendVersion: versionStore.warningMessage.backendVersion | ||
}) | ||
}} | ||
</div> | ||
</div> | ||
|
||
<!-- Action Buttons --> | ||
<div class="flex gap-2 justify-end"> | ||
<Button | ||
v-if="versionStore.isFrontendOutdated" | ||
:label="$t('versionMismatchWarning.updateFrontend')" | ||
size="small" | ||
severity="warn" | ||
@click="handleUpdate" | ||
/> | ||
<Button | ||
:label="$t('versionMismatchWarning.dismiss')" | ||
size="small" | ||
severity="secondary" | ||
@click="handleDismiss" | ||
/> | ||
</div> | ||
</div> | ||
</Message> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import Button from 'primevue/button' | ||
import Message from 'primevue/message' | ||
|
||
import { useVersionCompatibilityStore } from '@/stores/versionCompatibilityStore' | ||
|
||
const versionStore = useVersionCompatibilityStore() | ||
|
||
const handleDismiss = () => { | ||
void versionStore.dismissWarning() | ||
} | ||
|
||
const handleUpdate = () => { | ||
// Open ComfyUI documentation or update instructions | ||
window.open('https://docs.comfy.org/get_started/introduction', '_blank') | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
/* Custom styles if needed */ | ||
</style> | ||
christian-byrne marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import { defineStore } from 'pinia' | ||
import { computed, ref } from 'vue' | ||
|
||
import config from '@/config' | ||
import { useSettingStore } from '@/stores/settingStore' | ||
import { useSystemStatsStore } from '@/stores/systemStatsStore' | ||
import { compareVersions } from '@/utils/formatUtil' | ||
|
||
export const useVersionCompatibilityStore = defineStore( | ||
'versionCompatibility', | ||
() => { | ||
const systemStatsStore = useSystemStatsStore() | ||
const settingStore = useSettingStore() | ||
|
||
const isDismissed = ref(false) | ||
const dismissedVersion = ref<string | null>(null) | ||
|
||
const frontendVersion = computed(() => config.app_version) | ||
const backendVersion = computed( | ||
() => systemStatsStore.systemStats?.system?.comfyui_version ?? '' | ||
) | ||
const requiredFrontendVersion = computed( | ||
() => | ||
systemStatsStore.systemStats?.system?.required_frontend_version ?? '' | ||
) | ||
|
||
const isFrontendOutdated = computed(() => { | ||
if (!frontendVersion.value || !requiredFrontendVersion.value) { | ||
return false | ||
} | ||
return ( | ||
compareVersions(requiredFrontendVersion.value, frontendVersion.value) > | ||
0 | ||
) | ||
}) | ||
christian-byrne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const isFrontendNewer = computed(() => { | ||
if (!frontendVersion.value || !backendVersion.value) { | ||
return false | ||
} | ||
const versionDiff = compareVersions( | ||
frontendVersion.value, | ||
backendVersion.value | ||
) | ||
return versionDiff > 0 | ||
}) | ||
|
||
const hasVersionMismatch = computed(() => { | ||
return isFrontendOutdated.value || isFrontendNewer.value | ||
}) | ||
|
||
const shouldShowWarning = computed(() => { | ||
if (!hasVersionMismatch.value || isDismissed.value) { | ||
return false | ||
} | ||
|
||
const currentVersionKey = `${frontendVersion.value}-${backendVersion.value}-${requiredFrontendVersion.value}` | ||
christian-byrne marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return dismissedVersion.value !== currentVersionKey | ||
}) | ||
|
||
const warningMessage = computed(() => { | ||
if (isFrontendOutdated.value) { | ||
return { | ||
type: 'outdated' as const, | ||
frontendVersion: frontendVersion.value, | ||
requiredVersion: requiredFrontendVersion.value | ||
} | ||
} else if (isFrontendNewer.value) { | ||
return { | ||
type: 'newer' as const, | ||
frontendVersion: frontendVersion.value, | ||
backendVersion: backendVersion.value | ||
} | ||
} | ||
return null | ||
}) | ||
|
||
async function checkVersionCompatibility() { | ||
if (!systemStatsStore.systemStats) { | ||
await systemStatsStore.fetchSystemStats() | ||
} | ||
} | ||
|
||
async function dismissWarning() { | ||
isDismissed.value = true | ||
const currentVersionKey = `${frontendVersion.value}-${backendVersion.value}-${requiredFrontendVersion.value}` | ||
dismissedVersion.value = currentVersionKey | ||
|
||
await settingStore.set( | ||
'Comfy.VersionMismatch.DismissedVersion', | ||
currentVersionKey | ||
) | ||
} | ||
|
||
function restoreDismissalState() { | ||
const dismissed = settingStore.get( | ||
'Comfy.VersionMismatch.DismissedVersion' | ||
) | ||
if (dismissed) { | ||
dismissedVersion.value = dismissed | ||
const currentVersionKey = `${frontendVersion.value}-${backendVersion.value}-${requiredFrontendVersion.value}` | ||
isDismissed.value = dismissed === currentVersionKey | ||
} | ||
} | ||
|
||
async function initialize() { | ||
await checkVersionCompatibility() | ||
restoreDismissalState() | ||
} | ||
|
||
return { | ||
frontendVersion, | ||
backendVersion, | ||
requiredFrontendVersion, | ||
hasVersionMismatch, | ||
shouldShowWarning, | ||
warningMessage, | ||
isFrontendOutdated, | ||
isFrontendNewer, | ||
checkVersionCompatibility, | ||
dismissWarning, | ||
initialize | ||
} | ||
} | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.