File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 33import type Router from '../index'
44import { History } from './base'
55import { cleanPath } from '../util/path'
6+ import { START } from '../util/route'
67import { setupScroll , handleScroll } from '../util/scroll'
78import { pushState , replaceState } from '../util/push-state'
89
@@ -16,9 +17,18 @@ export class HTML5History extends History {
1617 setupScroll ( )
1718 }
1819
20+ const initLocation = getLocation ( this . base )
1921 window . addEventListener ( 'popstate' , e => {
2022 const current = this . current
21- this . transitionTo ( getLocation ( this . base ) , route => {
23+
24+ // Avoiding first `popstate` event dispatched in some browsers but first
25+ // history route not updated since async guard at the same time.
26+ const location = getLocation ( this . base )
27+ if ( this . current === START && location === initLocation ) {
28+ return
29+ }
30+
31+ this . transitionTo ( location , route => {
2232 if ( expectScroll ) {
2333 handleScroll ( router , route , current , true )
2434 }
You can’t perform that action at this time.
0 commit comments