fix: track detail page liked state race condition (#649)

The liked state wasn't loading on the track detail page because of a
race condition with auth initialization:

1. Page loads, navigation effect runs immediately
2. Effect sets loadedForTrackId = currentId
3. BUT auth.isAuthenticated is still false (async auth not resolved)
4. loadLikedState() is skipped
5. Auth resolves, isAuthenticated becomes true
6. Effect runs again, but loadedForTrackId === currentId, so nothing happens
7. Liked state is never fetched

Fix: Split into two separate effects:
- One for general track data (comments, etc.) - runs immediately
- One for liked state - runs when auth.isAuthenticated becomes true

This ensures the liked heart shows correctly even when auth loads after
the initial page render.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

authored by zzstoatzz.io Claude Opus 4.5 and committed by GitHub 9a9c5123 a2ade221

Changed files
+16 -4
frontend
src
routes
track
+16 -4
frontend/src/routes/track/[id]/+page.svelte
··· 305 305 306 306 // track which track we've loaded data for to detect navigation 307 307 let loadedForTrackId = $state<number | null>(null); 308 + // track if we've loaded liked state for this track (separate from general load) 309 + let likedStateLoadedForTrackId = $state<number | null>(null); 308 310 309 311 // reload data when navigating between track pages 310 312 // watch data.track.id (from server) not track.id (local state) ··· 321 323 newCommentText = ''; 322 324 editingCommentId = null; 323 325 editingCommentText = ''; 326 + likedStateLoadedForTrackId = null; // reset liked state tracking 324 327 325 328 // sync track from server data 326 329 track = data.track; ··· 328 331 // mark as loaded for this track 329 332 loadedForTrackId = currentId; 330 333 331 - // load fresh data 332 - if (auth.isAuthenticated) { 333 - void loadLikedState(); 334 - } 334 + // load comments (doesn't require auth) 335 335 void loadComments(); 336 + } 337 + }); 338 + 339 + // separate effect to load liked state when auth becomes available 340 + $effect(() => { 341 + const currentId = data.track?.id; 342 + if (!currentId || !browser) return; 343 + 344 + // load liked state when authenticated and haven't loaded for this track yet 345 + if (auth.isAuthenticated && likedStateLoadedForTrackId !== currentId) { 346 + likedStateLoadedForTrackId = currentId; 347 + void loadLikedState(); 336 348 } 337 349 }); 338 350