Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const render = async (reactElement, routes, applicationContext) => {
const scanResult = scan(original_$);
if (skipEmptyScans && isEmpty(scanResult.widgetDescriptors)) {
return { widgetConfigs: [], chunkNames: [], initialProps: {} };
}
const { widgetConfigs } = route(routes, scanResult);
// NOTE: https://github.com/faceyspacey/react-universal-component#static-hoisting
// Without calling this function, `getInitialProps` statics will not be defined.
hoistComponentStatics(widgetConfigs);
const initialProps = await resolveInitialProps(
{ ...context, ...applicationContext },
widgetConfigs
);
const wrappedElement = React.createElement(
PrescanContext.Provider,
{ value: { initialProps, widgetConfigs } },
reactElement
);
const render = async (reactElement, routes, applicationContext) => {
const scanResult = scan(original_$);
const { widgetConfigs } = route(routes, scanResult);
const context = { head, body, ...httpContext, ...applicationContext };
// NOTE: https://github.com/faceyspacey/react-universal-component#static-hoisting
// Without calling this function, `getInitialProps` statics will not be defined.
hoistComponentStatics(widgetConfigs);
initialProps = await resolveInitialProps(context, widgetConfigs);
const wrappedElement = React.createElement(
PrescanContext.Provider,
{ value: { initialProps, widgetConfigs } },
reactElement
);
// NOTE: https://github.com/faceyspacey/react-universal-component/issues/74
// We are doing this to make sure that the next `flushChunkNames()` call will only contain