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

@WarisR
Copy link

WarisR commented Sep 26, 2019

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

@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
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
None yet
Development

No branches or pull requests

4 participants