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

"'0' is not a valid attribute name" when navigating to a wildcard route with "props: true" #1994

Closed
KaelWD opened this issue Jan 14, 2018 · 1 comment
Assignees
Labels

Comments

@KaelWD
Copy link

KaelWD commented Jan 14, 2018

Version

3.0.1

Reproduction link

https://codesandbox.io/s/oo6x710k39

Steps to reproduce

  • click 'foo'
  • click 'bar'
  • observe the error
  • click 'home'
  • note that the page title no longer updates

What is expected?

Either give a console warning, or silently ignore the numeric props

What is actually happening?

The following error is thrown, breaking the whole page
image


In the actual app everything is wrapped in another dynamic route, which is what has props: true

@posva posva self-assigned this Jan 14, 2018
@posva
Copy link
Member

posva commented Jan 14, 2018

It looks like the regex generated adds a param named 0, and therefore vue-router tries to pass that as a prop, but since there's no prop named 0, it passes it as an attribute. Resulting on the error you see. A workaround would be using a function for props and manually stripping that off. I'm currently on a fix for this

@posva posva added the bug label Jan 14, 2018
posva added a commit that referenced this issue Jan 14, 2018
Fix #1994
Combining an asterisk route (*) with props: true would result in an
error because the name of the param would be the number 0 making it an
invalid attribute + the fact that vue passes props as attributes
if they're not declared as props
posva added a commit that referenced this issue Apr 11, 2018
Fix #1994
Combining an asterisk route (*) with props: true would result in an
error because the name of the param would be the number 0 making it an
invalid attribute + the fact that vue passes props as attributes
if they're not declared as props
posva added a commit that referenced this issue Jul 2, 2018
* fix(match): use fullPath for the param of * routes

Fix #1994
Combining an asterisk route (*) with props: true would result in an
error because the name of the param would be the number 0 making it an
invalid attribute + the fact that vue passes props as attributes
if they're not declared as props

* test(match): add test for asterisk route with props: true

* refactor(match): use pathMatch instead of fullPath for unnamed params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants