Skip to content

when using history mode in IE9 and fallback:false, page will flash before refresh #1675

Open
@hxlniada

Description

@hxlniada

Version

2.7.0

Reproduction link

the problematic code is at src/history/base.js line 64

transitionTo (location: RawLocation, onComplete?: Function, onAbort?: Function) {
   const route = this.router.match(location, this.current)
   this.confirmTransition(route, () => {
     this.updateRoute(route) // problem here
     onComplete && onComplete(route)
     this.ensureURL()

     // fire ready cbs once
     if (!this.ready) {
       this.ready = true
       this.readyCbs.forEach(cb => { cb(route) })
     }
   }, err => {
     if (onAbort) {
       onAbort(err)
     }
     if (err && !this.ready) {
       this.ready = true
       this.readyErrorCbs.forEach(cb => { cb(err) })
     }
   })
 }

when in ie9 history mode and set fallback:false, after page inited, all of the router change should work like a regular a page jump(just like location.href or location.replace (code is at ./src/util/push-state.js line 53))

window.location[replace ? 'replace' : 'assign'](url)

thats say, this.updateRoute(route) shouldn't be invoked when invoke history.push(except the time before page inited)

because this.updateRoute(route) will render the target component, and highlight the target router-link.

for example when I am at the home link('/'), then

  1. I click the nav tab help link('/help');
  2. then the code invoke this.updateRoute(route);
  3. the help nav is highlighted and the help page shown.;
  4. after a while, the code run into ./src/util/push-state.js and invoke the window.location method, the page will jump to the target link. after server response, page refreshed.

the step 3 should not happen in this story, we should just jump, otherwise the page will flash: show the targe page, highlight the target link, then after server response, do those task again. isn't it terrible?

Steps to reproduce

ie9, history mode, fallback: false

What is expected?

page won't show as if is't just a page jump(like location.href or location.replace)

What is actually happening?

page show before server response, lead to a page flash(like location.reload()), looks really terrible


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions