From 53b3d36ca34f37ae62522574befaf2a1bf064ed6 Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Wed, 25 Mar 2026 14:34:26 +0100 Subject: [PATCH] fix(svelte): restore $effect runes, replacing incorrect onMount usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit onMount is Svelte 4 idiom. In Svelte 5 runes mode $effect is the correct primitive for side effects and it provides additional behaviour onMount cannot: - IndexingProgress: $effect re-runs when jobId prop changes, restarting the polling loop for the new job. onMount would have missed prop changes. - search/+page.svelte: $effect with untrack() reads page.url params once on mount without tracking the URL as a reactive dependency, preventing goto() calls inside searchDocs() from triggering an infinite re-run loop. Restores the page store import from $app/state. - settings/+page.svelte: $effect with no reactive reads in the body runs exactly once on mount — equivalent to onMount but idiomatic Svelte 5. All three verified with svelte-autofixer: no issues. Co-Authored-By: Claude Sonnet 4.6 --- src/lib/components/IndexingProgress.svelte | 3 +-- src/routes/search/+page.svelte | 10 ++++++---- src/routes/settings/+page.svelte | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/components/IndexingProgress.svelte b/src/lib/components/IndexingProgress.svelte index 2d3cc30..f77f383 100644 --- a/src/lib/components/IndexingProgress.svelte +++ b/src/lib/components/IndexingProgress.svelte @@ -1,12 +1,11 @@