fix(matcher): add workaround hint to invalid params warning#2662
fix(matcher): add workaround hint to invalid params warning#2662shanliuling wants to merge 1 commit intovuejs:mainfrom
Conversation
The warning for discarded invalid params now includes a helpful hint for users encountering the catch-all route redirect scenario.
✅ Deploy Preview for vue-router canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes enhance the warning message displayed when invalid parameters are discarded during navigation to catch-all routes with named redirects. A test expectation is updated to verify the improved warning guidance is correctly emitted. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip You can get early access to new features in CodeRabbit.Enable the |
What is the problem?
When using a catch-all route with a named redirect like:
Users see a warning:
Discarded invalid param(s) "pathMatch" when navigating.The warning message doesn't explain how to fix the issue.
How did I fix it?
Enhanced the warning message to include a helpful workaround hint:
If you are using a catch-all route with a named redirect, pass an empty params object: redirect: { name: '...', params: {} }.This matches the workaround suggested by @posva in the issue comments.
How was this tested?
packages/router/__tests__/warnings.spec.tsto match the new warning formatCloses #1617
Summary by CodeRabbit
Release Notes