Skip to content

Commit 41b6445

Browse files
committed
fixed revalidateTag bug
1 parent d75e0f2 commit 41b6445

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/actions.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,12 @@ export const updatePost = async (data: Post) => {
247247
});
248248

249249
revalidateTag(`${post.site?.subdomain}-posts`);
250+
revalidateTag(`${post.site?.subdomain}-${post.slug}`);
251+
252+
// if the site has a custom domain, we need to revalidate those tags too
250253
post.site?.customDomain &&
251-
revalidateTag(`${post.site?.customDomain}-posts`);
254+
(revalidateTag(`${post.site?.customDomain}-posts`),
255+
revalidateTag(`${post.site?.customDomain}-${post.slug}`));
252256

253257
return response;
254258
} catch (error: any) {
@@ -300,9 +304,12 @@ export const updatePostMetadata = withPostAuth(
300304
}
301305

302306
revalidateTag(`${post.site?.subdomain}-posts`);
307+
revalidateTag(`${post.site?.subdomain}-${post.slug}`);
303308

309+
// if the site has a custom domain, we need to revalidate those tags too
304310
post.site?.customDomain &&
305-
revalidateTag(`${post.site?.customDomain}-posts`);
311+
(revalidateTag(`${post.site?.customDomain}-posts`),
312+
revalidateTag(`${post.site?.customDomain}-${post.slug}`));
306313

307314
return response;
308315
} catch (error: any) {

0 commit comments

Comments
 (0)