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
Initial route appears twice in browser history #9111
Comments
My project is also having this problem, in production also happens to me.
|
ME TOO. HELP HELP HELP!!! PLEASE SEND ME A MESSAGE!! I NEED SSR RENDER I NEED HISTORY MODE |
@qinxuanxin is there a reason you can't use abstract mode. From my experience they function almost identically. |
|
I have narrow this down to #9010 as reverting this 1 line of code will fix the double history push issue. As I am fairly new to nuxt I am not sure how to implement a fix to issue #9009 without breaking changes while still preventing a double history push. Thought this might be helpful. @enwin For people who are having this issue currently, the fixes are downgrading to version 2.15.3 or using history: abstract within your nuxt config. |
Hi @cpaczek. Thanks for narrowing it down. The linked PR should fix your issue. If you can test it I'd like your feedback on it. |
Hi, |
Versions
Reproduction
use
npm init nuxt-app my-app-name
to create a new app and leave everything defaults except change yarn to npm.run
npm run dev
go to
google.com
paste in
localhost:3000
It requires 2 clicks of the back button in order to get to google.com.
What is actually happening?
Because of how html5 history API works I believe (not entirely sure) nuxt is loading the index.html (which pushes once to history) then changes the route to the /newpage and pushes another entry to the session history. This causes you to have to use back twice to get to the original page.
What is Expected?
This is to be expected behavior when using history mode however I think the default mode should be changed from 'history' to 'abstract'
This is really up to the core team to decide if they want to change the default mode. Currently, in the docs it says that you should not change this mode due to server-side rendering however on the vue documentation it says abstract mode should be used for server-side rendering (and is the default).
I don't know exactly how
abstract
differs fromhistory
but from my limited testing, I don't see any downside.If the default does not get changed then I think that this solution should be somewhere more prominent in the docs.
The text was updated successfully, but these errors were encountered: