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

<router-link> component is mutating a prop #2938

Closed
guillaumeduliscouet opened this issue Sep 20, 2019 · 4 comments
Closed

<router-link> component is mutating a prop #2938

guillaumeduliscouet opened this issue Sep 20, 2019 · 4 comments

Comments

@guillaumeduliscouet
Copy link

Version

2.6.0

Reproduction link

https://codesandbox.io/embed/vue-template-hf9hq

Steps to reproduce

  • Click on 'route' link
  • Look at the console

What is expected?

In components/Parent.vue the object childRoute, that is passed as the to prop of <router-link>, should not be mutated.

What is actually happening?

It is mutated (the key parent is added to childRoute.params)

@posva
Copy link
Member

posva commented Sep 20, 2019

I haven't checked but there is a chance that the problem comes from router.resolve or a normalization function

@zrh122
Copy link
Contributor

zrh122 commented Sep 20, 2019

Maybe PR #2802 can fix it, but the test code in the PR is not for this issue. @posva

I have found this issue when i try to fix #2800, and this comment mention it. But i didn't add new issuse for it.

@posva
Copy link
Member

posva commented Sep 23, 2019

I completely forgot about that PR, thank you @zrh122 ! I will take another look

@posva posva added the has PR label Sep 23, 2019
posva added a commit to zrh122/vue-router that referenced this issue Sep 23, 2019
posva pushed a commit that referenced this issue Sep 23, 2019
Closes #2800, #2938 

* fix(normalizeLocation): add a copy for params with named locations

* test: add test case for #2938
@posva
Copy link
Member

posva commented Sep 23, 2019

Closed in #2802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants