From 703655a763abf0febe1fae6a3244c460435d2362 Mon Sep 17 00:00:00 2001 From: Ty Balascio Date: Fri, 25 Sep 2026 09:15:20 -0700 Subject: [PATCH] fix(fe): mask auto-run keyed on control, no settle loop Key the auto-run off a controlKey (sheet:sensitivity) so it fires on mask entry and on each sheet/sensitivity edit, but never re-fires when approveMask settles the overlay - preventing both the empty-preview bug and an infinite settle loop. --- frontend/src/capture/SessionCapture.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/capture/SessionCapture.svelte b/frontend/src/capture/SessionCapture.svelte index c68ad85..8e200b4 100644 --- a/frontend/src/capture/SessionCapture.svelte +++ b/frontend/src/capture/SessionCapture.svelte @@ -70,10 +70,12 @@ let fileInput: HTMLInputElement; - // Auto-run the mask when entering the mask screen and whenever the sheet or - // sensitivity changes, so the overlay (and preview) is populated without the - // owner having to press Approve first. - $: if (kind === 'mask' && cap.source && cap.source.widthPx > 0) { + // Auto-run the mask so the overlay (and preview) populate without the owner + // pressing Approve first. `controlKey` changes only on sheet/sensitivity + // edits (never on the overlay itself), so this fires on entry and on each + // control change - but not when approveMask settles the overlay (no loop). + $: controlKey = kind === 'mask' && cap.control ? `${cap.control.sheet}:${cap.control.sensitivity}` : null; + $: if (controlKey && cap.source && cap.source.widthPx > 0) { void session.approveMask(); }