You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1) Open "Reproduction link" -> OK - beforeResolve handler is run 2) Click "foo" btn -> OK - beforeResolve handler is run 3) Click "home" btn -> OK - beforeResolve handler is run 4) Click "destroy" btn -> OK - app destroyed 5) Click "start" btn -> FAIL - app started, but beforeResolve handler isn't run
What is expected?
beforeResolve is always run on start app
What is actually happening?
beforeResolve isn't run on restarting app
I am a maintainer of "Isomorphic Layout Composer" - Micro-frontends library( https://github.com/namecheap/ilc ).
And we have faced the problem of remounting Vue apps - when we render the same app second time, it will ignore running of beforeHooks.
Since on restart app history.current.matched contains last instance of route component so this condition:
I remember @joeldenning proposing something similar but I might be wrong. This seems reasonable to do when the last app is destroyed (set the location to START)
I agree - my recent pr changed things so that the popstate and hashchange listeners are cleaned up when the last vue app is destroyed, but it didn't change it so that the history entries would be cleaned up.
Version
3.3.4
Reproduction link
https://jsfiddle.net/NightNei/5bv7co0u/10/
Steps to reproduce
1) Open "Reproduction link" -> OK - beforeResolve handler is run
2) Click "foo" btn -> OK - beforeResolve handler is run
3) Click "home" btn -> OK - beforeResolve handler is run
4) Click "destroy" btn -> OK - app destroyed
5) Click "start" btn -> FAIL - app started, but beforeResolve handler isn't run
What is expected?
beforeResolve
is always run on start appWhat is actually happening?
beforeResolve
isn't run on restarting appI am a maintainer of "Isomorphic Layout Composer" - Micro-frontends library( https://github.com/namecheap/ilc ).
And we have faced the problem of remounting Vue apps - when we render the same app second time, it will ignore running of
beforeHooks
.Since on restart app
history.current.matched
contains last instance of route component so this condition:vue-router/src/history/base.js
Line 159 in dfc2892
true
androuter.beforeHooks
are ignored.On Destroy app we should reset
history.current
to default value(START
).The text was updated successfully, but these errors were encountered: