mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: restore output filtering and fix test failures
- Remove useEventListener mock that blocked configured event test - Restore filterByOutputNodes in useOutputHistory (accidentally removed) - Add missing nextTick in checkState deselect test - Fix oxlint disable comment syntax for perfReporter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ export function useOutputHistory(): {
|
||||
const linearStore = useLinearOutputStore()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const executionStore = useExecutionStore()
|
||||
const appModeStore = useAppModeStore()
|
||||
const queueStore = useQueueStore()
|
||||
|
||||
function matchesActiveWorkflow(task: { jobId: string | number }): boolean {
|
||||
@@ -52,6 +53,14 @@ export function useOutputHistory(): {
|
||||
return hasActiveWorkflowJobs()
|
||||
})
|
||||
|
||||
function filterByOutputNodes(items: ResultItemImpl[]): ResultItemImpl[] {
|
||||
const nodeIds = appModeStore.selectedOutputs
|
||||
if (!nodeIds.length) return []
|
||||
return items.filter((r) =>
|
||||
nodeIds.some((id) => String(id) === String(r.nodeId))
|
||||
)
|
||||
}
|
||||
|
||||
// True when the active workflow has running/pending jobs or in-progress items.
|
||||
const isWorkflowActive = computed(
|
||||
() =>
|
||||
@@ -89,7 +98,7 @@ export function useOutputHistory(): {
|
||||
if (!item?.id) return []
|
||||
|
||||
const cached = resolvedCache.get(item.id)
|
||||
if (cached) return cached
|
||||
if (cached) return filterByOutputNodes(cached)
|
||||
|
||||
const user_metadata = getOutputAssetMetadata(item.user_metadata)
|
||||
if (!user_metadata) return []
|
||||
@@ -102,7 +111,7 @@ export function useOutputHistory(): {
|
||||
.map((i) => i.output!)
|
||||
if (ordered.length > 0) {
|
||||
resolvedCache.set(item.id, ordered)
|
||||
return ordered
|
||||
return filterByOutputNodes(ordered)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,13 +126,13 @@ export function useOutputHistory(): {
|
||||
) {
|
||||
const reversed = user_metadata.allOutputs.toReversed()
|
||||
resolvedCache.set(item.id, reversed)
|
||||
return reversed
|
||||
return filterByOutputNodes(reversed)
|
||||
}
|
||||
|
||||
// Async fallback for multi-output jobs — fetch full /jobs/{id} detail.
|
||||
// This can be hit if the user executes the job then switches tabs.
|
||||
const existing = asyncRefs.get(item.id)
|
||||
if (existing) return existing.value
|
||||
if (existing) return filterByOutputNodes(existing.value)
|
||||
|
||||
const itemId = item.id
|
||||
const outputRef = useAsyncState(
|
||||
|
||||
@@ -47,11 +47,6 @@ vi.mock('@/components/builder/useEmptyWorkflowDialog', () => ({
|
||||
useEmptyWorkflowDialog: () => mockEmptyWorkflowDialog
|
||||
}))
|
||||
|
||||
vi.mock('@vueuse/core', async (importOriginal) => {
|
||||
const mod = (await importOriginal()) as Record<string, unknown>
|
||||
return { ...mod, useEventListener: vi.fn() }
|
||||
})
|
||||
|
||||
const mockSettings = vi.hoisted(() => {
|
||||
const store: Record<string, unknown> = {}
|
||||
return {
|
||||
@@ -368,6 +363,7 @@ describe('appModeStore', () => {
|
||||
it('calls checkState when input is deselected', async () => {
|
||||
const workflow = createBuilderWorkflow()
|
||||
workflowStore.activeWorkflow = workflow
|
||||
await nextTick()
|
||||
store.selectedInputs.push([42, 'prompt'])
|
||||
await nextTick()
|
||||
vi.mocked(workflow.changeTracker!.checkState).mockClear()
|
||||
|
||||
@@ -350,13 +350,7 @@ export const useAppModeStore = defineStore('appMode', () => {
|
||||
useEventListener(
|
||||
() => app.rootGraph?.events,
|
||||
'configured',
|
||||
() => {
|
||||
// Only reload from saved state during graph loading, not while
|
||||
// the user is actively editing in builder/app mode.
|
||||
if (!isBuilderMode.value && !isAppMode.value) {
|
||||
resetSelectedToWorkflow()
|
||||
}
|
||||
}
|
||||
resetSelectedToWorkflow
|
||||
)
|
||||
|
||||
function persistLinearData() {
|
||||
|
||||
Reference in New Issue
Block a user