= {
props,
// because next only remembers first value, default to short revalidation period
revalidate: config.DEFAULT_REVALIDATION,
};
+ let result = base as GetStaticPropsResult;
+
+ if (
+ shouldRedirectToRoot(
+ currentPath,
+ ___prefetch_manifest___ as Manifest | null,
+ )
+ ) {
+ result = {
+ ...base,
+ redirect: { destination: '/', permanent: false } as Redirect,
+ };
+ }
/// custom getStaticProps
- let result = base as GetStaticPropsResult
;
if (custom) {
const { props: customProps, ...rest } = (await custom(context)) as any;
result = {
- ...base,
...rest,
+ ...result,
props: { ...base.props, ...customProps },
};
}