From fa47a69c7bdcb1606c714eff6cb05fa3bd31cb29 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 1 Nov 2026 21:59:03 +0000 Subject: [PATCH 1/2] fix: keep the canvas rendering after a failed first frame (#22273) Follow-up to #21321, from review findings on its backports #21850 and #21851. - **The canvas keeps rendering after a frame throws.** #21321 caught a throwing first frame so the `LGraphCanvas` constructor could finish, but it also stopped the render loop, so the canvas stayed frozen for the rest of the session. Now any frame that throws is reported (each distinct error once). The 2D context is reset to its DPR base transform, both canvases are redrawn, and the loop continues. After 60 failed drawing frames with no successful draw in between, the loop stops, reports `error_rendering_canvas_stopped` and can be restarted. - **Pinch zoom no longer writes NaN, 0 or Infinity into the viewport.** This happened when two fingers touched the same point. A pinch that starts that way now measures from the first move where the fingers are at least 8px apart. - **`bootstrapTracer.outcome` reads `timed_out` after the watchdog fires,** not `pending`, so the missing-canvas report can tell a hung startup from one that is still loading.
Full context for agent readers **Tests, red first.** On `main` these failed: - `is_rendering` was false after a throwing first frame, and no frame was scheduled. - A persistently throwing draw escaped on frame 2 and left `is_rendering` stuck at true. - A same-point pinch changed the viewport. - `outcome` stayed `pending` after the watchdog fired. They pass with this PR. Local results: - `vitest run src/extensions/core src/lib/litegraph/src/LGraphCanvas* src/platform/telemetry/perf`: 1793 passed. - `pnpm typecheck`, oxlint and eslint are clean. - The pre-push hooks pass: depcruise, knip and the fallow audit. **Review rounds.** CodeRabbit and Cursor review findings on the first heads are addressed in 8014af1fa4: context reset, dirty marking, failure counting that ignores idle frames, an outer guard on the first frame, the 8px pinch threshold, no inline comments, and a later-frame failure test. **Adversarial review.** A fresh Claude reviewer ran on the first push (Codex is unavailable on this host). Its HIGH finding: a persistent failure still killed the loop on frame 2, and `is_rendering` stayed stuck. This push addresses that with the bounded retry, frame-level tests and stronger pinch assertions. **Also changed:** - The touchmove pinch branch moved into `handlePinchMove`, to stay under the complexity gate. - The test no longer imports `@/scripts/app`, which was a boundary-rule violation. **Not changed.** The `canvasOrReport('processMouseDown')` false-positive finding on the backports does not apply to `main`, which has no processMouseDown wrapper in `simpleTouchSupport.ts`. **Backports.** Labels are set for 1.57, 1.58 and 1.59. The 1.57 and 1.58 lines need the #21321 carriers first; 1.59 already has #21321.
Part of https://linear.app/comfyorg/issue/FRONT-3716 (cherry picked from commit 47d1cf42799108022dad92ddcdd43f8e4c09a5bc) --- .../core/simpleTouchSupport.test.ts | 77 +++++- src/extensions/core/simpleTouchSupport.ts | 51 ++-- .../src/LGraphCanvas.startRendering.test.ts | 236 +++++++++++++++++- src/lib/litegraph/src/LGraphCanvas.ts | 65 ++++- .../telemetry/perf/bootstrapTracer.test.ts | 10 + .../telemetry/perf/bootstrapTracer.ts | 8 +- 6 files changed, 401 insertions(+), 46 deletions(-) diff --git a/src/extensions/core/simpleTouchSupport.test.ts b/src/extensions/core/simpleTouchSupport.test.ts index aca6ae976c9..2aed350fc8e 100644 --- a/src/extensions/core/simpleTouchSupport.test.ts +++ b/src/extensions/core/simpleTouchSupport.test.ts @@ -12,22 +12,22 @@ type Viewport = Pick< 'scale' | 'offset' | 'min_scale' | 'max_scale' > -const { canvasEl, container, canvasAvailability } = vi.hoisted(() => { +const { canvasEl, container, canvasAvailability, ds } = vi.hoisted(() => { const container = document.createElement('div') const canvasEl = document.createElement('canvas') container.append(canvasEl) - return { container, canvasEl, canvasAvailability: { missing: false } } -}) - -const processMouseDown = vi.fn() - -vi.mock(import('@/scripts/app'), () => { const ds: Viewport = { scale: 1, offset: [0, 0], min_scale: 0.1, max_scale: 10 } + return { container, canvasEl, canvasAvailability: { missing: false }, ds } +}) + +const processMouseDown = vi.fn() + +vi.mock(import('@/scripts/app'), () => { const canvas = fromPartial({ ds, pointer: { isDown: false }, @@ -161,4 +161,67 @@ describe('Comfy.SimpleTouchSupport', () => { expect(processMouseDown).toHaveBeenCalledOnce() }) + + describe('pinch zoom', () => { + function resetViewport() { + ds.scale = 1 + ds.offset[0] = 0 + ds.offset[1] = 0 + } + + it.for([ + { name: 'start on the same point', start: 0, move: 100 }, + { name: 'start and stay on the same point', start: 0, move: 0 }, + { name: 'end on the same point', start: 100, move: 0 } + ])( + 'leaves the viewport unchanged when two fingers $name', + ({ start, move }) => { + resetViewport() + + dispatchTouch('touchstart', [ + touchAt(canvasEl), + touchAt(canvasEl, start) + ]) + dispatchTouch('touchmove', [touchAt(canvasEl), touchAt(canvasEl, move)]) + + expect({ scale: ds.scale, offset: [...ds.offset] }).toEqual({ + scale: 1, + offset: [0, 0] + }) + } + ) + + it('waits for a usable distance before measuring a pinch', () => { + resetViewport() + + dispatchTouch('touchstart', [touchAt(canvasEl), touchAt(canvasEl)]) + dispatchTouch('touchmove', [touchAt(canvasEl), touchAt(canvasEl, 7)]) + dispatchTouch('touchmove', [touchAt(canvasEl), touchAt(canvasEl, 50)]) + + expect(ds.scale).toBe(1) + }) + + it('zooms once fingers that started on the same point move apart', () => { + resetViewport() + + dispatchTouch('touchstart', [touchAt(canvasEl), touchAt(canvasEl)]) + dispatchTouch('touchmove', [touchAt(canvasEl), touchAt(canvasEl, 50)]) + dispatchTouch('touchmove', [touchAt(canvasEl), touchAt(canvasEl, 100)]) + + expect(ds.scale).toBe(2) + }) + + it('uses the minimum scale when converting pinch movement to an offset', () => { + resetViewport() + ds.scale = ds.min_scale + + dispatchTouch('touchstart', [touchAt(canvasEl), touchAt(canvasEl, 100)]) + dispatchTouch('touchmove', [touchAt(canvasEl, 20), touchAt(canvasEl, 70)]) + + expect({ scale: ds.scale, offset: [...ds.offset] }).toEqual({ + scale: 0.1, + offset: [-50, 0] + }) + }) + }) }) diff --git a/src/extensions/core/simpleTouchSupport.ts b/src/extensions/core/simpleTouchSupport.ts index 2bd9bda6e5e..e5e4225e00e 100644 --- a/src/extensions/core/simpleTouchSupport.ts +++ b/src/extensions/core/simpleTouchSupport.ts @@ -9,6 +9,8 @@ let touchCount = 0 type TouchPoint = { clientX: number; clientY: number } +const MIN_PINCH_DISTANCE = 8 + function zoomCanvasAroundPinch( canvas: LGraphCanvas, requestedScale: number, @@ -16,8 +18,6 @@ function zoomCanvasAroundPinch( lastTouch: TouchPoint ) { let scale = requestedScale - const newX = (center.clientX - lastTouch.clientX) / requestedScale - const newY = (center.clientY - lastTouch.clientY) / requestedScale if (scale < canvas.ds.min_scale) { scale = canvas.ds.min_scale @@ -25,6 +25,8 @@ function zoomCanvasAroundPinch( scale = canvas.ds.max_scale } + const newX = (center.clientX - lastTouch.clientX) / scale + const newY = (center.clientY - lastTouch.clientY) / scale const oldScale = canvas.ds.scale canvas.ds.scale = scale @@ -149,6 +151,32 @@ app.registerExtension({ // Also handle touchcancel which fires when touch is interrupted app.canvasEl.parentElement?.addEventListener('touchcancel', resetTouchState) + function handlePinchMove(e: TouchEvent) { + if (!lastTouch) return + const canvas = canvasOrReport('touchmove', e) + if (!canvas) return + e.preventDefault() + canvas.pointer.isDown = false + touchZooming = true + + LiteGraph.closeAllContextMenus(window) + canvas.search_box?.close() + const newTouchDist = getMultiTouchPos(e) + const center = getMultiTouchCenter(e) + + if (lastScale === null || touchDist === null) return + if (touchDist < MIN_PINCH_DISTANCE) { + touchDist = newTouchDist + lastScale = canvas.ds.scale + lastTouch = center + return + } + const scale = (lastScale * newTouchDist) / touchDist + if (!Number.isFinite(scale) || scale <= 0) return + + zoomCanvasAroundPinch(canvas, scale, center, lastTouch) + } + app.canvasEl.parentElement?.addEventListener( 'touchmove', (e) => { @@ -161,23 +189,8 @@ app.registerExtension({ touchTime = null } } - if (e.touches.length === 2 && lastTouch && !e.ctrlKey && !e.shiftKey) { - const canvas = canvasOrReport('touchmove', e) - if (!canvas) return - e.preventDefault() // Prevent browser from zooming when two textareas are touched - canvas.pointer.isDown = false - touchZooming = true - - LiteGraph.closeAllContextMenus(window) - canvas.search_box?.close() - const newTouchDist = getMultiTouchPos(e) - - const center = getMultiTouchCenter(e) - - if (lastScale === null || touchDist === null) return - const scale = (lastScale * newTouchDist) / touchDist - - zoomCanvasAroundPinch(canvas, scale, center, lastTouch) + if (e.touches.length === 2 && !e.ctrlKey && !e.shiftKey) { + handlePinchMove(e) } }, true diff --git a/src/lib/litegraph/src/LGraphCanvas.startRendering.test.ts b/src/lib/litegraph/src/LGraphCanvas.startRendering.test.ts index 7d2f28f4346..5e60fe5d9b6 100644 --- a/src/lib/litegraph/src/LGraphCanvas.startRendering.test.ts +++ b/src/lib/litegraph/src/LGraphCanvas.startRendering.test.ts @@ -2,24 +2,240 @@ import { describe, expect, it, vi } from 'vitest' import { LGraph, LGraphCanvas } from '@/lib/litegraph/src/litegraph' import { reportError } from '@/platform/telemetry/reportError' -import { createTestCanvasElement } from '@/utils/__tests__/canvasTestUtils' +import { + createMockCanvasRenderingContext2D, + createTestCanvasElement +} from '@/utils/__tests__/canvasTestUtils' + +function captureFrames() { + const frames: FrameRequestCallback[] = [] + const requestAnimationFrame = vi + .spyOn(window, 'requestAnimationFrame') + .mockImplementation((callback) => { + frames.push(callback) + return frames.length + }) + function runNextFrame() { + const frame = frames.shift() + if (!frame) throw new Error('No frame was scheduled') + frame(0) + } + function runFrames(count: number) { + for (let i = 0; i < count; i++) runNextFrame() + } + function drainFrames( + limit: number, + beforeFrame: (index: number) => void = () => {} + ) { + for (let i = 0; i < limit && frames.length > 0; i++) { + beforeFrame(i) + runNextFrame() + } + } + return { + requestAnimationFrame, + runNextFrame, + runFrames, + drainFrames, + frames + } +} + +function createCanvas() { + return new LGraphCanvas(createTestCanvasElement(), new LGraph(), { + skip_events: true + }) +} vi.mock(import('@/platform/telemetry/reportError')) describe('LGraphCanvas.startRendering', () => { - it('finishes constructing and reports when the first frame throws', () => { + it('finishes constructing, reports, and keeps rendering when the first frame throws', () => { + const { requestAnimationFrame } = captureFrames() const drawFailure = new TypeError('drawImage is patched') + vi.spyOn(LGraphCanvas.prototype, 'draw') + .mockImplementation(() => {}) + .mockImplementationOnce(() => { + throw drawFailure + }) + + const canvas = createCanvas() + + expect(canvas.is_rendering).toBe(true) + expect(requestAnimationFrame).toHaveBeenCalledOnce() + expect(reportError).toHaveBeenCalledExactlyOnceWith( + drawFailure, + expect.objectContaining({ + errorType: 'error_rendering_canvas_initial_frame' + }) + ) + }) + + it('restarts the failure budget after a frame draws successfully', () => { + const { runFrames, frames } = captureFrames() + let calls = 0 + const draw = vi + .spyOn(LGraphCanvas.prototype, 'draw') + .mockImplementation(() => { + calls++ + if (calls !== 60) throw new TypeError('transient') + }) + + const canvas = createCanvas() + runFrames(118) + + expect(draw).toHaveBeenCalledTimes(119) + expect(canvas.is_rendering).toBe(true) + expect(frames).toHaveLength(1) + expect(reportError).toHaveBeenCalledOnce() + }) + + it.for([ + { name: 'same type, different message', second: new TypeError('second') }, + { name: 'different type, same message', second: new RangeError('first') }, + { name: 'literal string matching an error key', second: 'TypeError:first' } + ])('reports each distinct drawing failure once: $name', ({ second }) => { + const { runFrames } = captureFrames() + const first = new TypeError('first') + vi.spyOn(LGraphCanvas.prototype, 'draw') + .mockImplementation(() => {}) + .mockImplementationOnce(() => { + throw first + }) + .mockImplementationOnce(() => { + throw first + }) + .mockImplementationOnce(() => { + throw second + }) + + createCanvas() + runFrames(2) + + expect( + vi + .mocked(reportError) + .mock.calls.map(([cause, options]) => [cause, options.errorType]) + ).toEqual([ + [first, 'error_rendering_canvas_initial_frame'], + [second, 'error_rendering_canvas_frame'] + ]) + }) + + it('stops after 60 consecutive failed frames, reports once more, and can restart', () => { + const { runFrames, frames } = captureFrames() vi.spyOn(LGraphCanvas.prototype, 'draw').mockImplementation(() => { - throw drawFailure + throw new TypeError('drawImage is patched') }) - const canvas = new LGraphCanvas(createTestCanvasElement(), new LGraph(), { - skip_events: true - }) + const canvas = createCanvas() + runFrames(58) + + expect(canvas.is_rendering).toBe(true) + expect(frames).toHaveLength(1) + + runFrames(1) expect(canvas.is_rendering).toBe(false) + expect(frames).toHaveLength(0) + expect( + vi.mocked(reportError).mock.calls.map(([, o]) => [o.errorType, o.context]) + ).toEqual([ + ['error_rendering_canvas_initial_frame', undefined], + ['error_rendering_canvas_stopped', { failedFrames: 60 }] + ]) + + vi.mocked(LGraphCanvas.prototype.draw).mockImplementation(() => {}) + canvas.startRendering() + expect(canvas.is_rendering).toBe(true) + }) + + it('reports a failure that first happens on a later frame and keeps rendering', () => { + const { runNextFrame, frames } = captureFrames() + const drawFailure: unknown = Object.assign(Object.create(null), { + message: 'extension draw failed' + }) + vi.spyOn(LGraphCanvas.prototype, 'draw') + .mockImplementation(() => {}) + .mockImplementationOnce(() => {}) + .mockImplementationOnce(() => { + throw drawFailure + }) + + const canvas = createCanvas() + runNextFrame() + + expect(canvas.is_rendering).toBe(true) + expect(frames).toHaveLength(1) expect(reportError).toHaveBeenCalledExactlyOnceWith( drawFailure, + expect.objectContaining({ errorType: 'error_rendering_canvas_frame' }) + ) + }) + + it('resets every drawing context and redraws everything after a failed frame', () => { + captureFrames() + const ctx = createMockCanvasRenderingContext2D() + const bgctx = createMockCanvasRenderingContext2D() + const overlayCtx = createMockCanvasRenderingContext2D() + vi.spyOn(LGraphCanvas.prototype, 'draw') + .mockImplementation(() => {}) + .mockImplementationOnce(function (this: LGraphCanvas) { + this.dirty_canvas = false + this.dirty_bgcanvas = false + throw new TypeError('mid-frame') + }) + + vi.stubGlobal('devicePixelRatio', 2) + const canvas = new LGraphCanvas( + createTestCanvasElement({ ctx }), + new LGraph(), + { skip_events: true, skip_render: true } + ) + canvas.bgcanvas = createTestCanvasElement({ ctx: bgctx }) + canvas.overlayCanvas = createTestCanvasElement({ ctx: overlayCtx }) + const resetFront = vi.spyOn(canvas.canvas, 'width', 'set') + const resetBackground = vi.spyOn(canvas.bgcanvas, 'width', 'set') + const resetOverlay = vi.spyOn(canvas.overlayCanvas, 'width', 'set') + + canvas.startRendering() + + expect(resetFront).toHaveBeenCalledOnce() + expect(resetBackground).toHaveBeenCalledOnce() + expect(resetOverlay).toHaveBeenCalledOnce() + expect(ctx.setTransform).toHaveBeenLastCalledWith(2, 0, 0, 2, 0, 0) + expect(bgctx.setTransform).toHaveBeenLastCalledWith(2, 0, 0, 2, 0, 0) + expect(overlayCtx.setTransform).toHaveBeenLastCalledWith(1, 0, 0, 1, 0, 0) + expect([canvas.dirty_canvas, canvas.dirty_bgcanvas]).toEqual([true, true]) + }) + + it('stops after repeated failures even when idle frames succeed between them', () => { + const { drainFrames } = captureFrames() + const draw = vi.spyOn(LGraphCanvas.prototype, 'draw') + draw.mockImplementation(function (this: LGraphCanvas) { + if (this.dirty_canvas) throw new TypeError('dirty frames fail') + }) + + const canvas = createCanvas() + drainFrames(200, (index) => { + canvas.dirty_canvas = canvas.dirty_bgcanvas = index % 2 === 0 + }) + + expect(canvas.is_rendering).toBe(false) + }) + + it('finishes constructing when scheduling the first frame throws', () => { + const schedulerFailure = new TypeError('patched scheduler') + vi.spyOn(LGraphCanvas.prototype, 'draw').mockImplementation(() => {}) + vi.spyOn(window, 'requestAnimationFrame').mockImplementation(() => { + throw schedulerFailure + }) + + const canvas = createCanvas() + + expect(canvas.is_rendering).toBe(false) + expect(reportError).toHaveBeenCalledExactlyOnceWith( + schedulerFailure, expect.objectContaining({ errorType: 'error_rendering_canvas_initial_frame' }) @@ -27,14 +243,10 @@ describe('LGraphCanvas.startRendering', () => { }) it('keeps scheduling frames when the first frame succeeds', () => { - const requestAnimationFrame = vi - .spyOn(window, 'requestAnimationFrame') - .mockReturnValue(0) + const { requestAnimationFrame } = captureFrames() vi.spyOn(LGraphCanvas.prototype, 'draw').mockImplementation(() => {}) - const canvas = new LGraphCanvas(createTestCanvasElement(), new LGraph(), { - skip_events: true - }) + const canvas = createCanvas() expect(canvas.is_rendering).toBe(true) expect(requestAnimationFrame).toHaveBeenCalledOnce() diff --git a/src/lib/litegraph/src/LGraphCanvas.ts b/src/lib/litegraph/src/LGraphCanvas.ts index 6a6dccff87e..438d3f6bbe7 100644 --- a/src/lib/litegraph/src/LGraphCanvas.ts +++ b/src/lib/litegraph/src/LGraphCanvas.ts @@ -505,6 +505,8 @@ function marqueeSelectsLinks( ) } +const MAX_FAILED_FRAMES = 60 + /** * This class is in charge of rendering one graph inside a canvas. And provides all the interaction required. * Valid callbacks are: onNodeSelected, onNodeDeselected, onShowNodePanel, onNodeDblClicked @@ -2453,20 +2455,63 @@ export class LGraphCanvas implements CustomEventDispatcher if (this.is_rendering) return this.is_rendering = true - try { - renderFrame.call(this) - } catch (cause) { - this.is_rendering = false + let isFirstFrame = true + let failedFrames = 0 + const reportedFailures = new Set() + + function reportFrameFailure(cause: unknown) { + const key = + cause instanceof Error + ? `error:${cause.name}:${cause.message}` + : typeof cause === 'string' + ? `string:${cause}` + : cause + if (reportedFailures.has(key)) return + reportedFailures.add(key) reportError(cause, { - errorType: 'error_rendering_canvas_initial_frame', + errorType: isFirstFrame + ? 'error_rendering_canvas_initial_frame' + : 'error_rendering_canvas_frame', surface: 'graph', tags: { feature_area: 'litegraph', operation: 'start_rendering' } }) } + const recoverFromFailedFrame = (cause: unknown) => { + failedFrames++ + reportFrameFailure(cause) + const { dpr, overlayCanvas } = this + for (const canvas of new Set([ + this.canvas, + this.bgcanvas, + overlayCanvas + ])) { + if (!canvas) continue + const { width } = canvas + canvas.width = width + const scale = canvas === overlayCanvas ? 1 : dpr + canvas.getContext('2d')?.setTransform(scale, 0, 0, scale, 0, 0) + } + this.setDirty(true, true) + if (failedFrames < MAX_FAILED_FRAMES) return + this.is_rendering = false + reportError(cause, { + errorType: 'error_rendering_canvas_stopped', + surface: 'graph', + tags: { feature_area: 'litegraph', operation: 'start_rendering' }, + context: { failedFrames } + }) + } + function renderFrame(this: LGraphCanvas) { if (!this.pause_rendering) { - this.draw() + const drawsSomething = this.dirty_canvas || this.dirty_bgcanvas + try { + this.draw() + if (drawsSomething) failedFrames = 0 + } catch (cause) { + recoverFromFailedFrame(cause) + } } const window = this.getCanvasWindow() @@ -2479,6 +2524,14 @@ export class LGraphCanvas implements CustomEventDispatcher window.requestAnimationFrame(renderFrame.bind(this)) } } + isFirstFrame = false + } + + try { + renderFrame.call(this) + } catch (cause) { + this.is_rendering = false + reportFrameFailure(cause) } } diff --git a/src/platform/telemetry/perf/bootstrapTracer.test.ts b/src/platform/telemetry/perf/bootstrapTracer.test.ts index 5168683821c..94eac32b484 100644 --- a/src/platform/telemetry/perf/bootstrapTracer.test.ts +++ b/src/platform/telemetry/perf/bootstrapTracer.test.ts @@ -152,6 +152,15 @@ describe('bootstrapTracer', () => { expect([before, tracer.outcome]).toEqual(['pending', 'failed']) }) + it('exposes a timed-out startup as timed out, not pending', async () => { + const tracer = new BootstrapTracer() + + tracer.armWatchdog(30_000) + await vi.advanceTimersByTimeAsync(30_000) + + expect(tracer.outcome).toBe('timed_out') + }) + it('reports only once', () => { const telemetry = sharedUseTelemetry() if (!telemetry) throw new Error('Expected telemetry mock') @@ -245,6 +254,7 @@ describe('bootstrapTracer', () => { .mocked(telemetry.trackBootstrapComplete) .mock.calls.map(([metadata]) => metadata.outcome) ).toEqual(['timed_out', 'completed']) + expect(tracer.outcome).toBe('completed') }) it('suspends cancellation reporting and lets a replacement complete', async () => { diff --git a/src/platform/telemetry/perf/bootstrapTracer.ts b/src/platform/telemetry/perf/bootstrapTracer.ts index 4528368adde..69de8636821 100644 --- a/src/platform/telemetry/perf/bootstrapTracer.ts +++ b/src/platform/telemetry/perf/bootstrapTracer.ts @@ -177,8 +177,12 @@ export class BootstrapTracer { return [...this._timings].sort((a, b) => a.startMs - b.startMs) } - get outcome(): 'completed' | 'failed' | 'pending' { - return this._outcome ?? 'pending' + /** + * `timed_out` is not terminal: startup can still finish after the watchdog + * fires, and the outcome then becomes `completed` or `failed`. + */ + get outcome(): 'completed' | 'failed' | 'timed_out' | 'pending' { + return this._outcome ?? (this._timeoutReported ? 'timed_out' : 'pending') } /** From d108be30b648d8e9f5b72f79054dc2d6e11f6703 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 1 Nov 2026 22:15:30 +0000 Subject: [PATCH 2/2] test: assert a pinch without a canvas raises no listener error Matches the assertion #22273 added on main; it was left out of the hand port. --- src/extensions/core/simpleTouchSupport.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/extensions/core/simpleTouchSupport.test.ts b/src/extensions/core/simpleTouchSupport.test.ts index 2aed350fc8e..f46c12a086e 100644 --- a/src/extensions/core/simpleTouchSupport.test.ts +++ b/src/extensions/core/simpleTouchSupport.test.ts @@ -153,12 +153,16 @@ describe('Comfy.SimpleTouchSupport', () => { it('ignores a pinch when no canvas exists', () => { withoutCanvas() + const listenerErrors = vi.fn() + window.addEventListener('error', listenerErrors) + onTestFinished(() => window.removeEventListener('error', listenerErrors)) const twoFingers = [touchAt(canvasEl), touchAt(canvasEl, 100)] dispatchTouch('touchstart', twoFingers) dispatchTouch('touchmove', twoFingers) pressPointer({ isPrimary: true }) + expect(listenerErrors).not.toHaveBeenCalled() expect(processMouseDown).toHaveBeenCalledOnce() })