From e4ff1f2d8666850b8df28a1a663d88578e762336 Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Tue, 7 Jul 2026 21:01:46 +0200 Subject: [PATCH] fix(frontent): ensure API is called once sveltekit was doing 3x API call to draw the page --- frontend/src/routes/files/[...path]/+page.svelte | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/files/[...path]/+page.svelte b/frontend/src/routes/files/[...path]/+page.svelte index 2dcbccef..ecc53fed 100644 --- a/frontend/src/routes/files/[...path]/+page.svelte +++ b/frontend/src/routes/files/[...path]/+page.svelte @@ -1431,10 +1431,21 @@ const SKELETON = [0, 1, 2, 3, 4, 5, 6, 7]; // Reload whenever the route path changes. + // + // `load()` reads several reactive signals in its sync phase + // (session.isExternalUser, session.homeFolderId, plus whatever + // its awaited callees touch). Naively calling `void load()` here + // tracks all of those as dependencies of this effect — and + // `session.loadHomeFolder()`'s own writes to `homeFolderId` + // during its resolution then re-trigger the effect, firing a + // second and third `load()` before the first has settled. Wrap + // in `untrack` so the ONLY dependency is `pathSegments` (route + // change is the sole legitimate re-trigger). $effect(() => { - // reference pathSegments so the effect re-runs on navigation void pathSegments; - void load(); + untrack(() => { + void load(); + }); }); // The command palette's "Upload files" action navigates here then dispatches