mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-07-15 03:37:48 +00:00
fix: mark live warnings seen reliably while panel is open
markAllSeen inside a watchEffect mutates its own dependency; the recursion guard drops the subscription after a mount-time clear, so warnings arriving while the panel was open stayed unseen. Use an immediate watch instead and pin the regression in the component test
This commit is contained in:
@@ -266,6 +266,7 @@ describe('DeprecationWarningsTab', () => {
|
||||
|
||||
it('marks warnings seen as they arrive while the panel is open', async () => {
|
||||
const store = useDeprecationWarningsStore()
|
||||
store.report({ message: 'before mount' })
|
||||
renderTab()
|
||||
|
||||
store.report({ message: 'arrived while open' })
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useIntervalFn } from '@vueuse/core'
|
||||
import type { MenuItem } from 'primevue/menuitem'
|
||||
import { computed, ref, watch, watchEffect } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import Badge from '@/components/common/Badge.vue'
|
||||
@@ -231,7 +231,14 @@ function warningMenuItems(warning: { key: string }): MenuItem[] {
|
||||
]
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
if (store.unseenCount > 0) store.markAllSeen()
|
||||
})
|
||||
// watch, not watchEffect: markAllSeen mutates the watched source, and a
|
||||
// watchEffect's recursion guard drops the subscription after a mount-time
|
||||
// clear, leaving warnings that arrive while the panel is open unseen forever.
|
||||
watch(
|
||||
() => store.unseenCount,
|
||||
(count) => {
|
||||
if (count > 0) store.markAllSeen()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user