We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 980ca32 commit d82eec8Copy full SHA for d82eec8
src/entry-client.js
@@ -44,18 +44,18 @@ router.onReady(() => {
44
const activated = matched.filter((c, i) => {
45
return diffed || (diffed = (prevMatched[i] !== c))
46
})
47
- if (!activated.length) {
+ const asyncDataHooks = activated.map(c => c.asyncData).filter(_ => _)
48
+ if (!asyncDataHooks.length) {
49
return next()
50
}
51
+
52
bar.start()
- Promise.all(activated.map(c => {
- if (c.asyncData) {
53
- return c.asyncData({ store, route: to })
54
- }
55
- })).then(() => {
56
- bar.finish()
57
- next()
58
- }).catch(next)
+ Promise.all(asyncDataHooks.map(hook => hook({ store, route: to })))
+ .then(() => {
+ bar.finish()
+ next()
+ })
+ .catch(next)
59
60
61
// actually mount to DOM
0 commit comments