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

Route path doesn't persist when using localePath #691

Closed
EderOBarreto opened this issue Apr 30, 2020 · 3 comments
Closed

Route path doesn't persist when using localePath #691

EderOBarreto opened this issue Apr 30, 2020 · 3 comments

Comments

@EderOBarreto
Copy link

EderOBarreto commented Apr 30, 2020

So, I noticed an unexpected behavior regarding the localePath. When pushing a new route just changing its params, but not the path of it, a problem it happens, the path isn't persisted, so I am not able to just redefine the params, without having to set the path again. This doesn't happen when using the router on Vue.
So, I don't know if this is really a bug, so I would like to ask if this is the expected behavior when dealing with localePath, or it's really a bug.

This is the code that I used.

localePath({params: { ...this.$route.params, step: `${Number(this.$route.params.step) + n}` }})

And this was the result.

image

Here is an example using Vue that I found on Stackoverflow.

https://stackoverflow.com/questions/56383717/how-to-replace-one-parameter-in-vuejs-router/56388903#56388903

This is my first "contribution", so please, be gentle.

@rchl
Copy link
Collaborator

rchl commented May 21, 2020

You need to pass a route name also but I'll look into it to see if I can make it optional.

@rchl rchl changed the title Route path doesn't persist when using locationpath Route path doesn't persist when using localPath May 21, 2020
@rchl rchl changed the title Route path doesn't persist when using localPath Route path doesn't persist when using localePath May 21, 2020
@rchl
Copy link
Collaborator

rchl commented May 21, 2020

Btw. It's localePath, not locationPath.

@EderOBarreto
Copy link
Author

Btw. It's localePath, not locationPath.

Yeah, I didn't notice. Sorry about that. And thanks for the answer.

rchl added a commit that referenced this issue May 22, 2020
In that case current route is used as a fallback for determined the target.

Resolves #691
@rchl rchl closed this as completed in #727 May 22, 2020
rchl added a commit that referenced this issue May 22, 2020
)

In that case current route is used as a fallback for determined the target.

Resolves #691
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

2 participants