From 31d68dc6ae3c8eb31eede519629d1020d877770a Mon Sep 17 00:00:00 2001 From: DrMint Date: Sat, 9 Apr 2022 13:47:44 +0200 Subject: [PATCH] Library items updates also update the parent items --- src/pages/api/revalidate.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/api/revalidate.ts b/src/pages/api/revalidate.ts index 0a203e7..bcc6107 100644 --- a/src/pages/api/revalidate.ts +++ b/src/pages/api/revalidate.ts @@ -47,6 +47,11 @@ type HookLibraryItem = { model: "library-item"; entry: { slug: string; + subitem_of: [ + { + slug: string; + } + ]; }; }; @@ -94,6 +99,9 @@ export default async function Mail( paths.push(`/library/${body.entry.slug}`); serverRuntimeConfig.locales?.map((locale: string) => { paths.push(`/${locale}/library/${body.entry.slug}`); + body.entry.subitem_of.map((parentItem) => { + paths.push(`/${locale}/library/${parentItem.slug}`); + }); paths.push(`/${locale}/library`); }); break; @@ -147,7 +155,7 @@ export default async function Mail( break; } - console.table(paths); + //console.table(paths); try { Promise.all(