Skip to content

🐛 Fix infinite goto loop on library list pages (media/games/books/music) - #182

Merged
Logan2234 merged 1 commit into
mainfrom
fix/library-browser-infinite-goto-loop
Sep 2, 2026
Merged

🐛 Fix infinite goto loop on library list pages (media/games/books/music)#182
Logan2234 merged 1 commit into
mainfrom
fix/library-browser-infinite-goto-loop

Conversation

@Logan2234

Copy link
Copy Markdown
Owner

Summary

Urgent hotfix. Every visit to /app/media, /app/games, /app/books or /app/music hangs the tab in an unrecoverable browser-level navigation-throttling loop (Chrome logs "Throttling navigation to prevent the browser from hanging"). A reload doesn't help — the loop restarts on load. This is what took the site down and prompted putting it into maintenance.

Root cause, confirmed by bisection — not related to the gamification work merged yesterday. LibraryBrowser.svelte's URL-sync $effect calls goto() with page.url.pathname read as a fallback when there's no query string to write. Svelte tracks every reactive read that happens during an effect's synchronous execution, including ones inside a called function — so page.url.pathname was a tracked dependency of this effect too, not just the six filter/sort fields it's meant to react to. goto() updates page.url, which made the effect see its own output as a fresh dependency change and re-fire itself, forever.

I reproduced this locally on fefe056 (the last commit on main before the gamification PRs) with zero gamification code involved — the bug is pre-existing, on the shared LibraryBrowser component (last touched in #176, well before any of this week's work), just surfaced by this deploy's timing.

Fix

Read page.url.pathname via untrack() — the exact idiom already used in (auth)/+layout.svelte for the same "read this value without depending on it" need. The effect still reacts to the six filter/sort fields as intended; it no longer reacts to its own goto() call.

Test plan

  • Reproduced the hang locally on fefe056 (pre-gamification) — confirmed unrelated to this week's work
  • Instrumented syncUrl() with a call counter — confirmed unbounded re-entry with identical state on every call before the fix
  • With the fix: /app/books, /app/games render correctly and load real data, console is clean (no throttling warnings), a hard reload works
  • pnpm --filter @loomkeep/web exec svelte-check — clean
  • pnpm --filter @loomkeep/api exec tsc --noEmit — clean (unaffected by this change, verified as part of the same pre-push run)

Next steps once this merges

The VPS is currently in manual maintenance mode (Logan). Once this is deployed, maintenance can come off. This should merge and deploy independently of the gamification PRs (#178 already merged; #179/#181 pending) — none of them touch LibraryBrowser.svelte.

🤖 Generated with Claude Code

LibraryBrowser's URL-sync $effect called goto() with page.url.pathname
read as a fallback when there's no query string to write. Svelte
tracks every reactive read that happens during an effect's execution,
including ones inside a called function — so page.url.pathname was a
tracked dependency of this effect too, not just the six filter/sort
fields it's meant to react to. goto() updates page.url, which made
the effect see its own output as a fresh change and re-fire itself,
forever: every visit to /app/media, /app/games, /app/books or
/app/music hung the tab in an unrecoverable navigation-throttling
loop (a reload doesn't help — the loop starts again on load).

Fixed by reading page.url.pathname via untrack(), the same idiom
already used in (auth)/+layout.svelte for an analogous "read this
without depending on it" need.

Reproduced and bisected locally: the bug is present on fefe056 (the
last main commit before yesterday's gamification merges) with no
gamification code involved at all — pre-existing, unrelated to any
of that work, just surfaced by this deploy's timing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the web apps/web (SvelteKit) label Sep 2, 2026
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/web/src/lib/components/LibraryBrowser.svelte 0.000% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Logan2234
Logan2234 merged commit f4ccaf4 into main Sep 2, 2026
19 of 20 checks passed
@Logan2234
Logan2234 deleted the fix/library-browser-infinite-goto-loop branch September 2, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

web apps/web (SvelteKit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant