mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-08 17:10:07 +00:00
[fix] Fix conflict red dot not syncing
between components Resolve reactivity issue by sharing useStorage refs across all composable instances to ensure UI consistency.
This commit is contained in:
@@ -80,13 +80,13 @@ const { isVisible: isHelpCenterVisible } = storeToRefs(helpCenterStore)
|
||||
const { shouldShowRedDot: showReleaseRedDot } = storeToRefs(releaseStore)
|
||||
|
||||
const conflictDetection = useConflictDetection()
|
||||
const conflictAcknowledgment = useConflictAcknowledgment()
|
||||
|
||||
const { showNodeConflictDialog } = useDialogService()
|
||||
|
||||
// Use conflict acknowledgment state from composable
|
||||
// Use conflict acknowledgment state from composable - call only once
|
||||
const { shouldShowRedDot: shouldShowConflictRedDot, markConflictsAsSeen } =
|
||||
conflictAcknowledgment
|
||||
useConflictAcknowledgment()
|
||||
|
||||
// Use either release red dot or conflict red dot
|
||||
const shouldShowRedDot = computed(() => {
|
||||
const releaseRedDot = showReleaseRedDot
|
||||
|
||||
@@ -21,6 +21,17 @@ interface ConflictAcknowledgmentState {
|
||||
warning_banner_dismissed: boolean
|
||||
}
|
||||
|
||||
// Shared state - initialized once and reused across all composable calls
|
||||
const modalDismissed = useStorage(STORAGE_KEYS.CONFLICT_MODAL_DISMISSED, false)
|
||||
const redDotDismissed = useStorage(
|
||||
STORAGE_KEYS.CONFLICT_RED_DOT_DISMISSED,
|
||||
false
|
||||
)
|
||||
const warningBannerDismissed = useStorage(
|
||||
STORAGE_KEYS.CONFLICT_WARNING_BANNER_DISMISSED,
|
||||
false
|
||||
)
|
||||
|
||||
/**
|
||||
* Composable for managing conflict acknowledgment state in localStorage
|
||||
*
|
||||
@@ -33,20 +44,6 @@ interface ConflictAcknowledgmentState {
|
||||
export function useConflictAcknowledgment() {
|
||||
const conflictDetectionStore = useConflictDetectionStore()
|
||||
|
||||
// Reactive state using VueUse's useStorage for automatic persistence
|
||||
const modalDismissed = useStorage(
|
||||
STORAGE_KEYS.CONFLICT_MODAL_DISMISSED,
|
||||
false
|
||||
)
|
||||
const redDotDismissed = useStorage(
|
||||
STORAGE_KEYS.CONFLICT_RED_DOT_DISMISSED,
|
||||
false
|
||||
)
|
||||
const warningBannerDismissed = useStorage(
|
||||
STORAGE_KEYS.CONFLICT_WARNING_BANNER_DISMISSED,
|
||||
false
|
||||
)
|
||||
|
||||
// Create computed state object for backward compatibility
|
||||
const state = computed<ConflictAcknowledgmentState>(() => ({
|
||||
modal_dismissed: modalDismissed.value,
|
||||
@@ -82,7 +79,8 @@ export function useConflictAcknowledgment() {
|
||||
const shouldShowConflictModal = computed(() => !modalDismissed.value)
|
||||
const shouldShowRedDot = computed(() => {
|
||||
if (!hasConflicts.value) return false
|
||||
return !redDotDismissed.value
|
||||
if (redDotDismissed.value) return false
|
||||
return true
|
||||
})
|
||||
const shouldShowManagerBanner = computed(() => {
|
||||
return hasConflicts.value && !warningBannerDismissed.value
|
||||
|
||||
@@ -454,9 +454,6 @@ export function useConflictDetection() {
|
||||
importFailInfo: Record<string, { msg: string; name: string; path: string }>
|
||||
): ConflictDetectionResult[] {
|
||||
const results: ConflictDetectionResult[] = []
|
||||
|
||||
console.log('@@@', importFailInfo)
|
||||
|
||||
if (!importFailInfo || typeof importFailInfo !== 'object') {
|
||||
return results
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user