File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-lazy-hydration" ,
3
- "version" : " 2.0.0-beta.2 " ,
3
+ "version" : " 2.0.0-beta.3 " ,
4
4
"description" : " Lazy hydration of server-side rendered Vue.js components" ,
5
5
"keywords" : [
6
6
" gridsome" ,
Original file line number Diff line number Diff line change 1
1
const isServer = typeof window === `undefined` ;
2
2
3
+ function isAsyncComponentFactory ( componentOrFactory ) {
4
+ return typeof componentOrFactory === `function` ;
5
+ }
6
+
7
+ function resolveComponent ( componentOrFactory ) {
8
+ if ( isAsyncComponentFactory ( componentOrFactory ) ) {
9
+ return componentOrFactory ( ) . then ( componentModule => componentModule . default ) ;
10
+ }
11
+ return componentOrFactory ;
12
+ }
13
+
3
14
export function makeNonce ( { component, hydrationPromise } ) {
4
15
if ( isServer ) return component ;
5
16
6
- return ( ) => hydrationPromise . then ( ( ) => component ) ;
17
+ return ( ) => hydrationPromise . then ( ( ) => resolveComponent ( component ) ) ;
7
18
}
You can’t perform that action at this time.
0 commit comments