File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -50,13 +50,18 @@ const normalizeRender = vm => {
50
50
}
51
51
52
52
function waitForSsrPrefetch ( vm , resolve , reject ) {
53
- if ( isDef ( vm . $options . ssrPrefetch ) ) {
53
+ const handlers = vm . $options . ssrPrefetch
54
+ if ( isDef ( handlers ) ) {
54
55
try {
55
- const result = vm . $options . ssrPrefetch . call ( vm , vm )
56
- if ( result && typeof result . then === 'function' ) {
57
- result . then ( resolve ) . catch ( reject )
58
- return
56
+ const promises = [ ]
57
+ for ( let i = 0 , j = handlers . length ; i < j ; i ++ ) {
58
+ const result = handlers [ i ] . call ( vm , vm )
59
+ if ( result && typeof result . then === 'function' ) {
60
+ promises . push ( result )
61
+ }
59
62
}
63
+ Promise . all ( promises ) . then ( resolve ) . catch ( reject )
64
+ return
60
65
} catch ( e ) {
61
66
reject ( e )
62
67
}
Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ export const LIFECYCLE_HOOKS = [
17
17
'destroyed' ,
18
18
'activated' ,
19
19
'deactivated' ,
20
- 'errorCaptured'
20
+ 'errorCaptured' ,
21
+ 'ssrPrefetch'
21
22
]
You can’t perform that action at this time.
0 commit comments