Skip to content

Commit d4e2ece

Browse files
committed
fix: call afterHooks later (vuejs#3250)
Move afterHooks in to confirmTransition so that they will be called even in abstract routing mode. Note that with this patch, hooks attached via router.onReady will now fire *before* router.afterEach but the the docs do not describe a specific execution order of these hooks.
1 parent b0ef497 commit d4e2ece

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/history/base.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,9 @@ export class History {
9191
this.confirmTransition(
9292
route,
9393
() => {
94-
const prev = this.current
9594
this.updateRoute(route)
9695
onComplete && onComplete(route)
9796
this.ensureURL()
98-
this.router.afterHooks.forEach(hook => {
99-
hook && hook(route, prev)
100-
})
10197

10298
// fire ready cbs once
10399
if (!this.ready) {
@@ -233,6 +229,10 @@ export class History {
233229
})
234230
})
235231
}
232+
233+
this.router.afterHooks.forEach(hook => {
234+
hook && hook(route, current)
235+
})
236236
})
237237
})
238238
}

0 commit comments

Comments
 (0)