From 6150fc7be5d3490459befcc64a8c40eff44192ae Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 14 Jun 2026 00:55:34 +0200 Subject: [PATCH] fix(timeline): track form dirtiness via change callbacks, not an $effect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The round-2 dirty-guard used an $effect that both read and wrote its `dirtyArmed` $state, so the self-write re-triggered the effect and `dirty` flipped true on mount — the beforeNavigate confirm then fired on every navigation away from an untouched form (caught by the round-3 clean-agent review + the Svelte autofixer, which flags assigning state inside $effect). Replace it with the component's existing idiomatic pattern: DatePrecisionField, PersonMultiSelect, and DocumentMultiSelect each gain an optional `onchange` callback fired on a real user edit, and EventForm passes `markDirty` to all three. Now date/precision/end-date and picker add/remove mark the form dirty exactly like title/type/description already did — no effect, no mount-timing trap. The new props are optional, so the other consumers (WhoWhenSection, the document forms) are unaffected. Svelte autofixer: clean. Addresses PR #832 review (round-3 clean-agent concern). Co-Authored-By: Claude Opus 4.8 --- .../lib/document/DocumentMultiSelect.svelte | 7 +++++- .../src/lib/person/PersonMultiSelect.svelte | 7 +++++- .../primitives/DatePrecisionField.svelte | 6 +++++ frontend/src/lib/timeline/EventForm.svelte | 24 +++++++------------ 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/frontend/src/lib/document/DocumentMultiSelect.svelte b/frontend/src/lib/document/DocumentMultiSelect.svelte index f190c5fb..e736b13d 100644 --- a/frontend/src/lib/document/DocumentMultiSelect.svelte +++ b/frontend/src/lib/document/DocumentMultiSelect.svelte @@ -15,6 +15,8 @@ interface Props { emptyLabel?: string; /** id of the search input so a