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

next(false) in beforeEach pushes state when using the browser forward button #2814

Open
eyalhakim opened this issue Jun 17, 2019 · 3 comments
Labels
bug fixed on 4.x This issue has been already fixed on the v4 but exists in v3

Comments

@eyalhakim
Copy link

Version

3.0.1

Reproduction link

https://codesandbox.io/s/vue-routing-example-mjmxd

Steps to reproduce

Click on "goodbye"
Click back in browser
Click forward in browser

last url is pushed into history

What is expected?

In ensureUrl, we need to pass false instead of true to make sure current (out-of-sync) url is replaced and not pushed to history

What is actually happening?

The next function passes true to the ensureUrl function thus making it push the out-of-sync url to history

@posva posva added the bug label Jun 18, 2019
@posva posva added this to Long term road (high prio, low complex) in Longterm Jul 3, 2019
@WarisR
Copy link

WarisR commented Sep 26, 2019

Hi, do you guys have a workaround for this issue?

@posva posva moved this from Long term road (high prio, low complex) to Design proposals + discussion (high prio, high complex) in Longterm Jan 15, 2020
@WofWca
Copy link

WofWca commented Feb 27, 2020

@eyalhakim Did you modify the reproduction example? Can't reproduce.

@WofWca
Copy link

WofWca commented Feb 27, 2020

In my very specific case it is not next(false), but next(otherRoute).
What I did is I mutated the to argument, then called next() with no arguments.

beforeEnter(to, from, next) {
  if (!isCool(to)) {
    mutateMakeCool(to);
    // Instead of this:
    // const newTo = getCool(to);
    // return next(newTo);
  }
  next();
}

@posva posva added the fixed on 4.x This issue has been already fixed on the v4 but exists in v3 label Feb 27, 2020
@posva posva added this to To Do in v3 pre v4 May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed on 4.x This issue has been already fixed on the v4 but exists in v3
Projects
Longterm
Design proposals + discussion (high p...
Development

No branches or pull requests

4 participants