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

Abstract mode starts with a negative history index #3020

wrosa-pariveda opened this issue Nov 6, 2019 · 1 comment


Copy link

@wrosa-pariveda wrosa-pariveda commented Nov 6, 2019



Reproduction link

Steps to reproduce

Create a new Vue Router in Abstract Mode

const router = new Router({ mode: 'abstract', routes: [{path: '/', component: {render: function(h){return h('div', 'Hello World!')}}}]})

What is expected?

Expect router.history.index to be 0

What is actually happening?

router.history.index is -1

The main issue this is causing me is that the first router.push() call will increase the index to 0 when it should be increased to 1. What this means is that router.back() does nothing until the second navigation, when router.history.index is set to 1, when it should be 2.

This basically makes it impossible to navigate back until my stack has 3 or more navigated routes.

F.Y.I. For some reason JSFiddle doesn't work with Vue Router in abstract mode, but the code is correct. (Comment out the mode and you'll see)


This comment has been minimized.

Copy link

@posva posva commented Nov 7, 2019

This is normal since abstract mode starts in a nowhere state and doing that initial push is necessary to start the router. Differently from other histories, abstract do not have access to the url to start the history automatically

@posva posva closed this Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.