summaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-17 22:51:36 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-17 22:51:36 +0200
commitf347cc1e4ae32289198d698f05f84119a708b599 (patch)
tree48ede76104f227dd371c1859f8a392d906144515 /src/pages
parent271ef6debaca7ed9a01829dcef3a37e90a2dff05 (diff)
fix: convert undefined into null inside GetStaticProps
Next.js was complaining because it cannot serialize undefined values.
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/thematique/[slug].tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index 23e6a8b..9586f77 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -218,14 +218,15 @@ export const getStaticProps: GetStaticProps<ThematicPageProps> = async ({
const allThematics = allThematicsEdges.edges.map((edge) =>
getPageLinkFromRawData(edge.node)
);
+ const allThematicsLinks = allThematics.filter(
+ (thematic) => thematic.slug !== (params!.slug as ThematicParams['slug'])
+ );
const translation = await loadTranslation(locale);
return {
props: {
currentThematic: JSON.parse(JSON.stringify(currentThematic)),
- thematics: allThematics.filter(
- (thematic) => thematic.slug !== (params!.slug as ThematicParams['slug'])
- ),
+ thematics: JSON.parse(JSON.stringify(allThematicsLinks)),
translation,
},
};