mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-02 12:11:58 +00:00
## Summary Refactors the error system to improve separation of concerns, fix DDD layer violations, and address code quality issues. - Extract `missingNodesErrorStore` from `executionErrorStore`, removing the delegation pattern that coupled missing-node logic into the execution error store - Extract `useNodeErrorFlagSync` composable for node error flag reconciliation (previously inlined) - Extract `useErrorClearingHooks` composable with explicit callback cleanup on node removal - Extract `useErrorActions` composable to deduplicate telemetry+command patterns across error card components - Move `getCnrIdFromNode`/`getCnrIdFromProperties` to `platform/nodeReplacement` layer (DDD fix) - Move `missingNodesErrorStore` to `platform/nodeReplacement` (DDD alignment) - Add unmount cancellation guard to `useErrorReport` async `onMounted` - Return watch stop handle from `useNodeErrorFlagSync` - Add `asyncResolvedIds` eviction on `missingNodesError` reset - Add `console.warn` to silent catch blocks and empty array guard - Hoist `useCommandStore` to setup scope, fix floating promises - Add `data-testid` to error groups, image/video error spans, copy button - Update E2E tests to use scoped locators and testids - Add unit tests for `onNodeRemoved` restoration and double-install guard Fixes #9875, Fixes #10027, Fixes #10033, Fixes #10085 ## Test plan - [x] Existing unit tests pass with updated imports and mocks - [x] New unit tests for `useErrorClearingHooks` (callback restoration, double-install guard) - [x] E2E tests updated to use scoped locators and `data-testid` - [ ] Manual: verify error tab shows runtime errors and missing nodes correctly - [ ] Manual: verify "Find on GitHub", "Copy", and "Get Help" buttons work in error cards ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10302-refactor-error-system-cleanup-store-separation-DDD-fix-test-improvements-3286d73d365081838279d045b8dd957a) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
116 lines
3.6 KiB
Vue
116 lines
3.6 KiB
Vue
<template>
|
|
<Transition
|
|
enter-active-class="transition-all duration-300 ease-out"
|
|
enter-from-class="-translate-y-3 opacity-0"
|
|
enter-to-class="translate-y-0 opacity-100"
|
|
>
|
|
<div v-if="isVisible" class="pointer-events-none flex w-full justify-end">
|
|
<div
|
|
role="alert"
|
|
aria-live="assertive"
|
|
data-testid="error-overlay"
|
|
class="pointer-events-auto flex w-80 min-w-72 flex-col overflow-hidden rounded-lg border border-interface-stroke bg-comfy-menu-bg shadow-interface transition-colors duration-200 ease-in-out"
|
|
>
|
|
<!-- Header -->
|
|
<div class="flex h-12 items-center gap-2 px-4">
|
|
<span class="flex-1 text-sm font-bold text-destructive-background">
|
|
{{ errorCountLabel }}
|
|
</span>
|
|
<Button
|
|
variant="muted-textonly"
|
|
size="icon-sm"
|
|
:aria-label="t('g.close')"
|
|
@click="dismiss"
|
|
>
|
|
<i class="icon-[lucide--x] block size-5 leading-none" />
|
|
</Button>
|
|
</div>
|
|
|
|
<!-- Body -->
|
|
<div class="px-4 pb-3">
|
|
<ul class="m-0 flex list-none flex-col gap-1.5 p-0">
|
|
<li
|
|
v-for="(message, idx) in groupedErrorMessages"
|
|
:key="idx"
|
|
class="flex min-w-0 items-baseline gap-2 text-sm/snug text-muted-foreground"
|
|
>
|
|
<span
|
|
class="mt-1.5 size-1 shrink-0 rounded-full bg-muted-foreground"
|
|
/>
|
|
<span class="line-clamp-3 wrap-break-word whitespace-pre-wrap">{{
|
|
message
|
|
}}</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<div class="flex items-center justify-end gap-4 px-4 py-3">
|
|
<Button variant="muted-textonly" size="unset" @click="dismiss">
|
|
{{ t('g.dismiss') }}
|
|
</Button>
|
|
<Button
|
|
variant="secondary"
|
|
size="lg"
|
|
data-testid="error-overlay-see-errors"
|
|
@click="seeErrors"
|
|
>
|
|
{{
|
|
appMode ? t('linearMode.error.goto') : t('errorOverlay.seeErrors')
|
|
}}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Transition>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { storeToRefs } from 'pinia'
|
|
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useExecutionErrorStore } from '@/stores/executionErrorStore'
|
|
import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { useErrorGroups } from '@/components/rightSidePanel/errors/useErrorGroups'
|
|
|
|
defineProps<{ appMode?: boolean }>()
|
|
|
|
const { t } = useI18n()
|
|
const executionErrorStore = useExecutionErrorStore()
|
|
const rightSidePanelStore = useRightSidePanelStore()
|
|
const canvasStore = useCanvasStore()
|
|
|
|
const { totalErrorCount, isErrorOverlayOpen } = storeToRefs(executionErrorStore)
|
|
const { groupedErrorMessages } = useErrorGroups(ref(''), t)
|
|
|
|
const errorCountLabel = computed(() =>
|
|
t(
|
|
'errorOverlay.errorCount',
|
|
{ count: totalErrorCount.value },
|
|
totalErrorCount.value
|
|
)
|
|
)
|
|
|
|
const isVisible = computed(
|
|
() => isErrorOverlayOpen.value && totalErrorCount.value > 0
|
|
)
|
|
|
|
function dismiss() {
|
|
executionErrorStore.dismissErrorOverlay()
|
|
}
|
|
|
|
function seeErrors() {
|
|
canvasStore.linearMode = false
|
|
if (canvasStore.canvas) {
|
|
canvasStore.canvas.deselectAll()
|
|
canvasStore.updateSelectedItems()
|
|
}
|
|
|
|
rightSidePanelStore.openPanel('errors')
|
|
executionErrorStore.dismissErrorOverlay()
|
|
}
|
|
</script>
|