File tree 1 file changed +12
-29
lines changed
1 file changed +12
-29
lines changed Original file line number Diff line number Diff line change @@ -24,35 +24,18 @@ export class ReportNamespaces {
24
24
}
25
25
26
26
export function composeInitialProps ( ForComponent ) {
27
- return ( ctx ) =>
28
- new Promise ( ( resolve ) => {
29
- const i18nInitialProps = getInitialProps ( ) ;
30
-
31
- if ( ForComponent . getInitialProps ) {
32
- ForComponent . getInitialProps ( ctx ) . then ( ( componentsInitialProps ) => {
33
- resolve ( {
34
- ...componentsInitialProps ,
35
- ...i18nInitialProps ,
36
- } ) ;
37
- } ) ;
38
- } else {
39
- resolve ( i18nInitialProps ) ;
40
- }
41
- } ) ;
42
- // Avoid async for now - so we do not need to pull in regenerator
43
-
44
- // return async ctx => {
45
- // const componentsInitialProps = ForComponent.getInitialProps
46
- // ? await ForComponent.getInitialProps(ctx)
47
- // : {};
48
-
49
- // const i18nInitialProps = getInitialProps();
50
-
51
- // return {
52
- // ...componentsInitialProps,
53
- // ...i18nInitialProps,
54
- // };
55
- // };
27
+ return async ( ctx ) => {
28
+ const componentsInitialProps = ForComponent . getInitialProps
29
+ ? await ForComponent . getInitialProps ( ctx )
30
+ : { } ;
31
+
32
+ const i18nInitialProps = getInitialProps ( ) ;
33
+
34
+ return {
35
+ ...componentsInitialProps ,
36
+ ...i18nInitialProps ,
37
+ } ;
38
+ } ;
56
39
}
57
40
58
41
export function getInitialProps ( ) {
You can’t perform that action at this time.
0 commit comments