vuejs / vue-router

🚦 The official router for Vue 2
http://v3.router.vuejs.org/
MIT License
18.99k stars 5.06k forks source link

setupListeners not invoke if user customer route guard not invoke next parameter function #3810

Closed workkk98 closed 1 year ago

workkk98 commented 1 year ago

Version

3.6.5

Reproduction link

stackblitz.com

Steps to reproduce

  1. location bar enter "xxx/about" url.
  2. click root link
  3. click foo link
  4. click browser navigation back button.

What is expected?

"root" page should be render. vue-router handleRoutingEvent function should be invoked, but not.

What is actually happening?

page content not changed.


I know this case because "/abount" beforeEnter guard isn't correct. But I think vue-router listen popstate Should not be affected by user code

LinusBorg commented 1 year ago

It's documented that next() needs to be called to validate a navigation. That's just how it works.