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

manually url navigation canceled messes up history #2573

Open
joenil opened this Issue Jan 9, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@joenil
Copy link

joenil commented Jan 9, 2019

Version

3.0.2

Reproduction link

https://codesandbox.io/s/l9omkjv939

Steps to reproduce

  1. Let's say the page url now is /?animal=dog, and the animal field only accept dot or cat
  2. When a user manually change the dog to duck, or via back button, it triggered next(false) for prevent the url change inside beforeRouteUpdate
  3. Due to the next(false) or next(error) pushed a new location history, the previous record is /?animal=duck and current record is /?animal=dog
  4. Then we click the browser's back button, it turn to the step 2. and I can't go back to the earlier state!

What is expected?

I don't know... how can I handle this scenario?

What is actually happening?

Can't go back via back button after called next(false/error)

@posva posva changed the title How can I go back when a navigation canceled by next(false/error)? manually url navigation canceled messes up hash history Jan 9, 2019

@posva

This comment has been minimized.

Copy link
Member

posva commented Jan 9, 2019

Not sure what is causing this, but only happing when manually changing the url in hash mode. It doesn't happen with regular navigation

@joenil

This comment has been minimized.

Copy link

joenil commented Jan 10, 2019

@posva I think because the url manually changing in the omnibox forcibly pushed a new history state by the browser's mechanism, when the history back, it always encounter the manually pushed state, and it get stuck

@posva posva changed the title manually url navigation canceled messes up hash history manually url navigation canceled messes up history Jan 11, 2019

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