Next.js Discord

Discord Forum

Revalidate segment and tags

Unanswered
Bedlington Terrier posted this in #help-forum
Open in Discord
Avatar
Bedlington TerrierOP
I have getPage function in my server component which look like this:
export const revalidate = 60;

async function getPage({ creator, slug, vendor }: UrlParams) {
  const res = await fetch(
    `${apiUrl}/api/storefront/page/${vendor}/${creator}/${slug}/`,
    {
      next: { tags: [`${vendor}_${creator}_${slug}`] },
    }
  );

I expect this fetch to be invalidated either automatically every minute or immediately after the first user visit following a call to /api/revalidate?tag=....

However, currently, it doesn’t respect the automatic segment invalidation (every minute) and only invalidates after a POST request to /api/revalidate.

0 Replies