Skip to content

Commit e850abf

Browse files
committed
fixed revalidateTag (was revalidating the wrong ones)
1 parent 41b6445 commit e850abf

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

lib/actions.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ export const updateSite = withSiteAuth(
157157
}
158158
console.log(
159159
"Updated site data! Revalidating tags: ",
160-
`${site.subdomain}-metadata`,
160+
`${site.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-metadata`,
161161
`${site.customDomain}-metadata`,
162162
);
163-
revalidateTag(`${site.subdomain}-metadata`);
163+
revalidateTag(
164+
`${site.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-metadata`,
165+
);
164166
site.customDomain && revalidateTag(`${site.customDomain}-metadata`);
165167

166168
return response;
@@ -211,7 +213,9 @@ export const createPost = withSiteAuth(async (_: FormData, site: Site) => {
211213
},
212214
});
213215

214-
revalidateTag(`${site.subdomain}-posts`);
216+
revalidateTag(
217+
`${site.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-posts`,
218+
);
215219
site.customDomain && revalidateTag(`${site.customDomain}-posts`);
216220

217221
return response;
@@ -246,8 +250,12 @@ export const updatePost = async (data: Post) => {
246250
},
247251
});
248252

249-
revalidateTag(`${post.site?.subdomain}-posts`);
250-
revalidateTag(`${post.site?.subdomain}-${post.slug}`);
253+
revalidateTag(
254+
`${post.site?.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-posts`,
255+
);
256+
revalidateTag(
257+
`${post.site?.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-${post.slug}`,
258+
);
251259

252260
// if the site has a custom domain, we need to revalidate those tags too
253261
post.site?.customDomain &&
@@ -303,8 +311,12 @@ export const updatePostMetadata = withPostAuth(
303311
});
304312
}
305313

306-
revalidateTag(`${post.site?.subdomain}-posts`);
307-
revalidateTag(`${post.site?.subdomain}-${post.slug}`);
314+
revalidateTag(
315+
`${post.site?.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-posts`,
316+
);
317+
revalidateTag(
318+
`${post.site?.subdomain}.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}-${post.slug}`,
319+
);
308320

309321
// if the site has a custom domain, we need to revalidate those tags too
310322
post.site?.customDomain &&

0 commit comments

Comments
 (0)