fix: revert "refactor: don't reparse upon navigation (#6398)"#6468
fix: revert "refactor: don't reparse upon navigation (#6398)"#6468
Conversation
This reverts commit 6cbd96e.
📝 WalkthroughWalkthroughThis PR removes snapshot-based route-matching optimizations and simplifies the navigation API across TanStack Router. Changes include eliminating Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
|
View your CI Pipeline Execution ↗ for commit aa6f711
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/router-core/src/router.ts (1)
700-706: GuardparsedParamswhenskipRouteOnParseErroris enabled.
parsedParamsis now optional, butkey in parsedParams!will throw if it’sundefined. This can surface as a runtime error during matching whenskipRouteOnParseErroris used. Please guard with a fallback object (or default it ingetMatchedRoutes).🐛 Proposed fix
- const { foundRoute, routeParams, parsedParams } = matchedRoutesResult + const { foundRoute, routeParams, parsedParams } = matchedRoutesResult + const safeParsedParams = parsedParams ?? {} ... - for (const key in usedParams) { - if (key in parsedParams!) { - strictParams[key] = parsedParams![key] - } - } + for (const key in usedParams) { + if (key in safeParsedParams) { + strictParams[key] = (safeParsedParams as any)[key] + } + }Also applies to: 1266-1558, 2781-2787
♻️ Duplicate comments (2)
packages/react-router/tests/useNavigate.test.tsx (2)
1450-1465: Same sync-assumption as earlier segment.
No additional notes beyond the verification about immediate router state assertions above.
1763-1778: Same sync-assumption as earlier segment.
No additional notes beyond the verification about immediate router state assertions above.
…TanStack#6468) Revert "refactor: don't reparse upon navigation (TanStack#6398)" This reverts commit 6cbd96e.
This reverts commit 6cbd96e.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Breaking Changes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.