Skip to content

Commit 2160fc9

Browse files
committed
fix activate/data hook call order for subRoutes (fix #348)
1 parent 340697a commit 2160fc9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/pipeline.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,26 @@ export function activate (view, transition, depth, cb, reuse) {
200200
cb && cb()
201201
}
202202

203-
// called after activation hook is resolved
204-
const afterActivate = () => {
205-
view.activated = true
203+
const afterData = () => {
206204
// activate the child view
207205
if (view.childView) {
208206
activate(view.childView, transition, depth + 1, null, reuse || view.keepAlive)
209207
}
208+
insert()
209+
}
210+
211+
// called after activation hook is resolved
212+
const afterActivate = () => {
213+
view.activated = true
210214
if (dataHook && waitForData) {
211215
// wait until data loaded to insert
212-
loadData(component, transition, dataHook, insert, cleanup)
216+
loadData(component, transition, dataHook, afterData, cleanup)
213217
} else {
214218
// load data and insert at the same time
215219
if (dataHook) {
216220
loadData(component, transition, dataHook)
217221
}
218-
insert()
222+
afterData()
219223
}
220224
}
221225

0 commit comments

Comments
 (0)