Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dx): warn when addRoute cannot find the parent #2157

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

skirtles-code
Copy link
Contributor

This adds a warning when calling router.addRoute('foo', { ... }) if the parent route isn't found.

Without this warning, it can be difficult to tell why addRoute isn't working correctly. With an absolute path, beginning with /, the addition seems to succeed, but the new route won't be a child of the intended parent. With a relative path, it'll fail to add the new route, but with a confusing error about the path being invalid.

I've also added a test for the similar warning in removeRoute, though the warning itself already existed.

Copy link

netlify bot commented Mar 2, 2024

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit 364cd04
🔍 Latest deploy log https://app.netlify.com/sites/vue-router/deploys/65e27d8ab04dbe0008af77a3

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.90%. Comparing base (13303bd) to head (364cd04).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2157   +/-   ##
=======================================
  Coverage   90.90%   90.90%           
=======================================
  Files          24       24           
  Lines        1121     1121           
  Branches      347      347           
=======================================
  Hits         1019     1019           
  Misses         63       63           
  Partials       39       39           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@posva posva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@posva posva merged commit 6377083 into vuejs:main Mar 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants