Skip to content

fix: infinite request loop on user profile page - #168

Merged
HermanPlay merged 1 commit into
masterfrom
fix/profile-request-loop
Aug 11, 2026
Merged

HermanPlay merged 1 commit into
masterfrom
fix/profile-request-loop

Conversation

@HermanPlay

Copy link
Copy Markdown
Member

Bug

Opening the user profile page fired an endless stream of /users/me requests until the API rate-limited the client.

Root cause

Infinite loop between two components:

  • dashboard/+layout.svelte renders a spinner while userStore.isLoading() and only mounts page content after a user is loaded.
  • profile/+page.svelte used createQuery calling getCurrentUser(), which sets userStore.loading = true at the start of the fetch.

Sequence: page mounts → createQuery fetches → loading=true → layout swaps to spinner → page unmounts → fetch completes → loading=false → layout renders page → remount → createQuery runs again → loop.

Fix

Profile page reads the already-loaded user from userStore (guaranteed present by the dashboard layout guard) instead of issuing its own getCurrentUser fetch.

Verification

  • pnpm run build succeeds
  • Deployed locally; profile page loads without repeated requests

The dashboard layout renders a spinner while userStore.isLoading() and only
mounts page content once a user is loaded. The profile page's createQuery
called getCurrentUser() which sets userStore.loading=true -> layout swaps
to spinner -> page unmounts -> loading resolves false -> page remounts ->
createQuery refetches -> loading=true ... infinite loop, hitting the API
until rate-limited.

Profile now reads the already-loaded user from userStore (the dashboard
layout guarantees it exists) instead of re-fetching.
@HermanPlay
HermanPlay merged commit 8657f62 into master Aug 11, 2026
1 check passed
@HermanPlay
HermanPlay deleted the fix/profile-request-loop branch August 11, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant