refactor(app): migrate $app/stores to $app/state #1207 - #1237
Conversation
$app/stores is deprecated since Kit 2.12; $app/state's page is rune-backed. Three of the five files were mechanical swaps (snapshot reads at init, runes-mode reads, onMount/template reads). Two needed real care because a bare page.* read inside a legacy $: statement is not tracked and would run exactly once: - AreaPage.svelte: activeSection derives from page.params.section reactively (section tab switching). Bridged with toStore(() => page.params.section) so the legacy $: keeps a real store dependency. Full runes conversion is #1208 scope. - +layout.svelte: the ?language= applier ran on every navigation via its $page store dep. Replaced with afterNavigate (fires on mount + every client-side nav — identical cadence, clearer intent). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for btcmap ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
📝 WalkthroughWalkthroughThe PR migrates five Svelte components from ChangesSvelteKit app-state migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR migrates the remaining $app/stores consumers to the deprecated replacement $app/state, taking care to preserve reactivity in legacy-mode components where a plain page.* read would otherwise not re-trigger $: statements.
Changes:
- Replaced
$app/storespageusage with$app/statepageacross affected routes/components. - Updated the root layout’s
?language=syncing from a$:+$pagedependency toafterNavigate()to keep the same “on mount + every navigation” cadence. - Bridged
page.params.sectioninto legacy$:reactivity inAreaPage.svelteusingtoStore(() => ...)so section-tab navigation continues to update.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/leaderboard/+page.svelte | Swaps $page store reads to page state reads inside a runes-mode event handler. |
| src/routes/communities/map/+page.svelte | Replaces $page snapshot query-param reads with page state snapshot reads. |
| src/routes/+layout.svelte | Uses afterNavigate() to re-apply ?language= on mount and client navigations using $app/state. |
| src/routes/+error.svelte | Replaces $page.status / $page.error reads with page.status / page.error in mount logic and template. |
| src/components/area/AreaPage.svelte | Uses toStore(() => page.params.section) to keep legacy $: section switching reactive with $app/state. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/routes/communities/map/`+page.svelte:
- Line 42: Replace the non-rune page usage with the established legacy page
subscription/helper in src/routes/communities/map/+page.svelte at lines 42 and
59-61, and in src/routes/+error.svelte at lines 8-11 and 38. Keep the adapter
unchanged and ensure page.url.searchParams, page.status, and page.error continue
updating during client-side navigation.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 55611e3a-41fb-4b9a-bbde-b75dc16bb7f8
📒 Files selected for processing (5)
src/components/area/AreaPage.sveltesrc/routes/+error.sveltesrc/routes/+layout.sveltesrc/routes/communities/map/+page.sveltesrc/routes/leaderboard/+page.svelte

Summary
Migrates all five
$app/storesconsumers to$app/state(#1207). The store flavor is deprecated since Kit 2.12; the state flavor is rune-backed — which is exactly why this wasn't a blind find-and-replace: a barepage.*read inside a legacy-mode$:statement is not tracked and runs exactly once. Each file got a per-site audit:communities/map/+page.svelteconstsnapshot reads at initleaderboard/+page.svelte+error.svelteonMount+ templateAreaPage.svelte$:driving section-tab switchingtoStore(() => page.params.section)— Svelte's official bridge gives the legacy$:a real store dependency; without it, tab navigation would silently stop updatingactiveSection. Full runes conversion is #1208 scope.+layout.svelte$: if (browser)applying?language=on every navafterNavigate()— fires on mount + every client-side navigation, the identical cadence the$pagestore dep provided; a bare read would have applied the language param only on initial loadVerified
svelte-check0/0, Biome clean, 584/584 tests, prod build green?language=still appliesCloses #1207. Part of #1201.
🤖 Generated with Claude Code
Summary by CodeRabbit