Repository navigation
fix(svelte): keep useParams() current when navigating within the same page - #610
Merged
Brooooooklyn merged 1 commit intoOct 27, 2026
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-svelte-use-params-refresh-void-cloud.voidzero-docs.workers.dev (commit 2d81b43)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
… page On a dynamic route such as /posts/[slug], a Link from /posts/a to /posts/b reuses the same page component. App.svelte swapped in a new params object on each navigation, but useParams() had already handed the old one to the page and its layouts, so `params.slug` kept showing "a" while the page props moved to "b". Update the params object in place, the same way shared data is updated, so the object returned by useParams() stays reactive and current. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brooooooklyn
force-pushed
the
fix/svelte-use-params-refresh
branch
from
October 27, 2026 07:54
7748d0d to
2d81b43
Compare
Brooooooklyn
changed the base branch from
main
to
fix/auth-token-picked-platform
October 27, 2026 07:55
Brooooooklyn
enabled stacked auto-merge (squash)
October 27, 2026 08:34
stacked auto-merge was automatically disabled
October 27, 2026 08:34
Auto-merge was disabled for another pull request in the stack
fengmk2
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In Svelte pages,
useParams()goes stale when you navigate between two URLs that use the same page component. On/posts/[slug], clicking a<Link>from/posts/ato/posts/bupdates the page props, butconst params = useParams(); params.slugstill reads"a".App.sveltereplaced the params object on every navigation.useParams()reads the context only once, when the component is set up, so the page and its layouts kept the old object.What changed
packages/svelte/src/runtime/App.svelte: params are now updated in place, the same way shared data already was. The oldreplaceSharedhelper is nowreplaceInPlace(target, next)and is used for both.Tests
packages/svelte/test/integration/use-params-navigation.test.ts: mounts the realApp.sveltein Chromium with a page that callsuseParams(), updates the stores the way the Svelte pages client does on a Link navigation, and checks that the rendered slug changes fromatob. It fails without the fix.To check
useParams()now always returns the same object for the life of the app, asuseShared()already does.🤖 Generated with Claude Code