mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): unsub from hooks when unmounting indicator (#22592)
This commit is contained in:
parent
8b61c29f93
commit
1a61cb22ec
@ -54,14 +54,16 @@ export default defineComponent({
|
||||
}
|
||||
})
|
||||
|
||||
nuxtApp.hook('page:finish', indicator.finish)
|
||||
nuxtApp.hook('vue:error', indicator.finish)
|
||||
const unsubPage = nuxtApp.hook('page:finish', indicator.finish)
|
||||
const unsubError = nuxtApp.hook('vue:error', indicator.finish)
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
const index = globalMiddleware.indexOf(indicator.start)
|
||||
if (index >= 0) {
|
||||
globalMiddleware.splice(index, 1)
|
||||
}
|
||||
unsubPage()
|
||||
unsubError()
|
||||
indicator.clear()
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user