Navigation Menu

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

Named route records with optional root-level param will result in an empty URL when you don't use the param #1357

Closed
hworld opened this issue Mar 31, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@hworld
Copy link

hworld commented Mar 31, 2022

Version

4.0.14

Reproduction link

jsfiddle.net/5m1nz3gf/

Steps to reproduce

Inspect the "Hot" url to see that the tag's href attribute is an empty string.
The other link's href attributes are correct.
If you click on the Hot link, it routes correctly since the router is the thing doing the direction, but if you look at the status bar when hovering the link, it'll show the current page's address since the href is empty. This breaks middle clicking to open in new tab since it will just open the current page instead of what vue router would actually direct to.

What is expected?

It should render the href attribute as '/'

What is actually happening?

Empty href

@posva posva added the bug Something isn't working label Apr 1, 2022
@posva posva closed this as completed in 2f1e9b9 Apr 1, 2022
@gryphonmyers
Copy link

@posva I see this got merged, however, I don't believe the issue was addressed. The issue still seems to be affecting all recent versions of vue-router. I have tried 4.0.15, 4.0.16, 4.1.1 and all suffer from this problem. Can you please re-evaluate?

@posva
Copy link
Member

posva commented Jul 7, 2022

I checked and this is working

@gryphonmyers
Copy link

gryphonmyers commented Jul 7, 2022

It's broken in the jsfiddle linked above - inspect element on the "Hot" link and see that it has no href. I wasn't sure if the jsfiddle was locked to a specific version of vue-router so I recreated in a new fiddle that is exactly the same code - same result.

@gryphonmyers
Copy link

@posva any thoughts on why the OP's example is still suffering from the original reported problem? Happy to be proven wrong here, but as I say I am also suffering from this problem (in current version of vue-router) and I only ended up on this issue because I was about to report it myself.

@posva
Copy link
Member

posva commented Jul 12, 2022

the repro is using an outdated version of vue router, remove the next tag and it works. If you found another bug open a new issue with a boiled down reproduction.

@gryphonmyers
Copy link

OK thanks for that clarification. I will figure out what is different about my use case and create a separate issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants