audio streaming app plyr.fm
37
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: feed mode not persisting across hard refresh (#1286)

auth.isAuthenticated starts false and flips true after /auth/me
resolves. the probe $effect's else branch fired immediately on
mount (before auth resolved), saw feedMode === 'for-you', and
reset it to 'latest' — clobbering the localStorage-persisted
preference on every page load.

fix: gate the else branch on !auth.loading so it only fires after
auth has actually resolved and the user is genuinely not authenticated.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

authored by

nate nowack
Claude Opus 4.6 (1M context)
and committed by
GitHub
ea0ddb9b 24a59db9

+7 -3
+6 -2
frontend/src/routes/+page.svelte
··· 145 145 }); 146 146 147 147 // probe for-you availability — lightweight fetch decoupled from cache 148 - // so tag filtering and cache state changes don't re-trigger this 148 + // so tag filtering and cache state changes don't re-trigger this. 149 + // auth.loading starts true and flips false after /auth/me resolves — 150 + // we must wait for that before reacting to isAuthenticated === false, 151 + // otherwise the initial false state resets feedMode on every hard refresh. 149 152 $effect(() => { 150 153 if (auth.isAuthenticated) { 151 154 fetch(`${API_URL}/for-you/?limit=1`, { credentials: 'include' }) ··· 164 167 .catch(() => { 165 168 forYouAvailable = false; 166 169 }); 167 - } else { 170 + } else if (!auth.loading) { 171 + // auth finished loading and user is not authenticated 168 172 forYouAvailable = false; 169 173 if (feedMode === 'for-you') { 170 174 feedMode = 'latest';
+1 -1
loq.toml
··· 232 232 233 233 [[rules]] 234 234 path = "frontend/src/routes/+page.svelte" 235 - max_lines = 652 235 + max_lines = 656 236 236 237 237 [[rules]] 238 238 path = "frontend/src/lib/components/AlbumUploadForm.svelte"