-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Params from the current location are not copied to the target location #189
Comments
I forgot a thing. Only the params that exist in the target location's route definition should be copied from the previous one. |
Feel free to do a PR if you want! I will help you get it through. As you noticed, we only need to copy params that exist at the target location. It's also not a merge: if the target location contains params, we use those instead, that way we can easily remove optional params and it's still easy to keep existing params with About the comment by name, I probably meant by key |
Hmm, the |
I'm not sure I get what you mean, the |
To give some context, this is roughly what the router looks like in my app: const routes = [
{
path: "/configuration/:configuration",
name: "Configuration",
redirect: { name: "Step1" }
},
{
path: "/configuration/:configuration/step-1",
name: "Step1",
component: FirstStep
},
// ... other configuration steps
] Now when I go to For all the other routes I'd just do |
I was giving this a spin because I thought that You can take a look at https://jsfiddle.net/posva/j9ts2dqp/ (Vue Router 3). Going from I will fix this |
I've noticed that there is a todo to merge the params from the current location into the target location.
https://github.com/vuejs/vue-router-next/blob/9697134c05f0f4c6fde48a773880946074e95666/src/matcher/index.ts#L201
However, this is not the only place where you'd need to merge route params. When there is a redirect in a route, it only uses the params from the
redirectedFrom
location or thetargetLocation
. But instead, the params fromtargetLocation
should be merged into theredirectedFrom
location if it exists.Here's what I did to get most of the old Vue Router 3 behavior back: https://github.com/janispritzkau/vue-router-next/commit/bc5d568d5412380f226e518ae6d50e14e079d2b1
I'm not sure what is meant with
Should this be done by name.
in the comment above.The text was updated successfully, but these errors were encountered: