Uh oh!
There was an error while loading. Please reload this page.
fix(router): preserve raw params for match identity - #7966
Conversation
📝 WalkthroughWalkthroughThe route matcher now separates raw URL parameters from parsed parameters and preserves parsed values across reused matches. Matching callers use the new tuple result. React and Solid tests verify refreshed parameters and loader data after revisiting routes. ChangesParsed parameter refresh
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Router
participant RouteLoader
participant View
User->>Router: Navigate with new URL parameters
Router->>Router: Match routes and parse parameters
Router->>RouteLoader: Load data with parsed parameters
RouteLoader-->>Router: Return refreshed loader data
Router-->>View: Render parsed parameters and loader data
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
View your CI Pipeline Execution ↗ for commit 1ad6a52
☁️ Nx Cloud last updated this comment at |
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better. |
Merging this PR will degrade performance by 0.83%
|
Uh oh!
There was an error while loading. Please reload this page.
What changed
getMatchedRoutesas a labeled tuple and name the unparsed valuerawParamsthroughout its consumers.Root cause
matchRoutesInternalreused the same object for raw URL params and parsed params. A structuredparams.parseresult could therefore replace a path-param string with an object before a descendant route was interpolated. That produced an incorrect match ID (for example,[object Object]), allowing a cached match to restore stale parsed params and loader data.The fix preserves raw params for match identity while maintaining a separate parsed-param snapshot. It still calls
interpolatePathonce per route and does not require stringifying params without route context. The tuple contract removes repeated object keys and therawParamslabel documents the invariant at each internal consumer.Validation
test:unit: 30 projects passedtest:types: 40 projects passed across supported TypeScript versionstest:eslint: 32 projects passedFixes#7964, Fixes#7731
Summary by CodeRabbit
Bug Fixes
Tests