Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
composedInitialProps = await ComposedComponent.getInitialProps(ctx);
}
if (!isServer) {
return {
...composedInitialProps,
environment: null,
};
}
let queryProps = {};
let queryRecords = {};
const environment = initEnvironment();
const {query, variables} = options;
if (query) {
queryProps = await fetchQuery(environment, query, variables);
queryRecords = environment
.getStore()
.getSource()
.toJSON();
}
return {
...composedInitialProps,
...queryProps,
queryRecords,
environment,
};
};