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

fix(resolve): exclude empty optional arguments from params #2434

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

babu-ch
Copy link

@babu-ch babu-ch commented Jan 7, 2025

fix #2419

Removed if optional parameter is empty
Now the param will match if :to is string and if it is object

In the case of string path, it should not be an empty string parameter(Right?)
, so I thought there would be no problem with excluding it.

However, this may be a breaking change if you have users who were using this

In addition, I added a router-link to Playgound to check the operation.

Copy link

netlify bot commented Jan 7, 2025

Deploy Preview for vue-router canceled.

Name Link
🔨 Latest commit 66f824f
🔍 Latest deploy log https://app.netlify.com/sites/vue-router/deploys/677e37044abd7e000807f3dd

@@ -310,6 +310,12 @@ export function createRouterMatcher(
// we know the matcher works because we tested the regexp
params = matcher.parse(path)!
name = matcher.record.name

matcher?.keys.forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the ?. be changed to . instead?

Copy link
Author

Choose a reason for hiding this comment

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

@skirtles-code
Thank you for your comment.
Oh, it was a remnant from writing outside of this block.
Fixed!
66f824f

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.

Active class not applied on RouterLink when using to with string or object with path key
2 participants