Skip to content

Commit 5c3c3eb

Browse files
authored
use the commented out async code (#1761)
1 parent 1361608 commit 5c3c3eb

File tree

1 file changed

+12
-29
lines changed

1 file changed

+12
-29
lines changed

src/context.js

+12-29
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,18 @@ export class ReportNamespaces {
2424
}
2525

2626
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+
};
5639
}
5740

5841
export function getInitialProps() {

0 commit comments

Comments
 (0)