fix(react-router): re-export PathParamError from framework packages#7612
fix(react-router): re-export PathParamError from framework packages#7612LeSingh1 wants to merge 1 commit into
Conversation
PathParamError was exported from @tanstack/router-core but missing from the re-export lists in @tanstack/react-router, @tanstack/solid-router, and @tanstack/vue-router. Users who needed to detect path-param validation failures via `error instanceof PathParamError` were forced to import from the transitive dependency @tanstack/router-core directly. Adds PathParamError alongside the existing SearchParamError export in all three framework packages, and adds a test in react-router to verify that a failing params.parse callback surfaces as a PathParamError caught by the route's errorComponent. Fixes TanStack#7545
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR exposes ChangesPathParamError public API
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Summary
Closes #7545.
PathParamErroris exported from@tanstack/router-corebut was absent from the re-export lists in@tanstack/react-router,@tanstack/solid-router, and@tanstack/vue-router.SearchParamErrorwas already re-exported on that same line —PathParamErrorwas simply never added alongside it.The practical impact: users who want to distinguish path-param validation failures from other errors in an
onErrorhandler orerrorComponenthad to write:After this fix they can write:
Changes
packages/react-router/src/index.tsx— addPathParamErrorto the existingSearchParamErrorre-exportpackages/solid-router/src/index.tsx— samepackages/vue-router/src/index.tsx— samepackages/react-router/tests/router.test.tsx— new test verifying that aparams.parsefailure surfaces asPathParamErrorin the route'serrorComponent, imported directly from@tanstack/react-routerTest plan
pnpm --filter @tanstack/react-router test:unit— all 44 test files pass (913 tests, +1 from baseline)Summary by CodeRabbit
New Features
PathParamErroris now exported from React, Solid, and Vue router packages, enabling developers to handle path parameter validation errors more effectively.Tests