Skip to content

Commit

Permalink
use the commented out async code (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
VIKTORVAV99 authored Jul 15, 2024
1 parent 1361608 commit 5c3c3eb
Showing 1 changed file with 12 additions and 29 deletions.
41 changes: 12 additions & 29 deletions src/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,18 @@ export class ReportNamespaces {
}

export function composeInitialProps(ForComponent) {
return (ctx) =>
new Promise((resolve) => {
const i18nInitialProps = getInitialProps();

if (ForComponent.getInitialProps) {
ForComponent.getInitialProps(ctx).then((componentsInitialProps) => {
resolve({
...componentsInitialProps,
...i18nInitialProps,
});
});
} else {
resolve(i18nInitialProps);
}
});
// Avoid async for now - so we do not need to pull in regenerator

// return async ctx => {
// const componentsInitialProps = ForComponent.getInitialProps
// ? await ForComponent.getInitialProps(ctx)
// : {};

// const i18nInitialProps = getInitialProps();

// return {
// ...componentsInitialProps,
// ...i18nInitialProps,
// };
// };
return async (ctx) => {
const componentsInitialProps = ForComponent.getInitialProps
? await ForComponent.getInitialProps(ctx)
: {};

const i18nInitialProps = getInitialProps();

return {
...componentsInitialProps,
...i18nInitialProps,
};
};
}

export function getInitialProps() {
Expand Down

0 comments on commit 5c3c3eb

Please sign in to comment.