refactor: remove redundant animated filtering from TaskItemImpl

animated is already excluded by METADATA_KEYS in parseNodeOutput, so the
_.omit call in the constructor was redundant. Also removes unused
es-toolkit/compat import.

Addresses review feedback:
https://github.com/Comfy-Org/ComfyUI_frontend/pull/9622#discussion_r2925170222
This commit is contained in:
bymyself
2026-03-12 08:00:08 -07:00
parent 7535857276
commit 1b8a3fb734
2 changed files with 5 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ vi.mock('@/scripts/api', () => ({
}))
describe('TaskItemImpl', () => {
it('should remove animated property from outputs during construction', () => {
it('should exclude animated from flatOutputs', () => {
const job = createHistoryJob(0, 'job-id')
const taskItem = new TaskItemImpl(job, {
'node-1': {
@@ -75,11 +75,9 @@ describe('TaskItemImpl', () => {
}
})
// Check that animated property was removed
expect('animated' in taskItem.outputs['node-1']).toBe(false)
expect(taskItem.outputs['node-1'].images).toBeDefined()
expect(taskItem.outputs['node-1'].images?.[0]?.filename).toBe('test.png')
expect(taskItem.flatOutputs).toHaveLength(1)
expect(taskItem.flatOutputs[0].filename).toBe('test.png')
expect(taskItem.flatOutputs[0].mediaType).toBe('images')
})
it('should handle outputs without animated property', () => {

View File

@@ -1,4 +1,3 @@
import _ from 'es-toolkit/compat'
import { defineStore } from 'pinia'
import { computed, ref, shallowRef, toRaw, toValue } from 'vue'
@@ -257,10 +256,7 @@ export class TaskItemImpl {
}
}
: {})
// Remove animated outputs from the outputs object
this.outputs = _.mapValues(effectiveOutputs, (nodeOutputs) =>
_.omit(nodeOutputs, 'animated')
)
this.outputs = effectiveOutputs
this.flatOutputs = flatOutputs ?? this.calculateFlatOutputs()
}