0

I have several Vercel sites deployed and many of them use ISR to generate new static content. I'm working on a new site and for some reason ISR is not working when I make changes in my CMS (Contentful).

Anyone know how to go about troubleshooting why this isn't working? Nothing in my function error logs on Vercel indicate a problem.

Here's the component code where ISR is not working:

import React, { useLayoutEffect } from 'react'
import Layout from '@/components/layout/Layout'
import AdsHeader from '@/components/layout/AdsHeader'
import { getEntry, getSlugs, getEntries } from '@/lib/contentful'
import { blogPostMeta } from '@/lib/blog'
import BlogDrawer from '@/components/Blog/BlogDrawer'

import Post from '@/components/Blog/Post'

export default function BlogPostIndex({ post, posts }) {
    const metaData = blogPostMeta(post);

    return (
        <>
            <AdsHeader />
            <Layout
                pageTitle={post.fields.title}
                headerTitle="Blog"
            >
                <Post post={post} posts={posts} metaData={metaData} />
            </Layout>
            <BlogDrawer posts={posts} />
        </>
    )
}

export async function getStaticProps({ params }) {
    const post = await getEntry('post', params.slug);
    const posts = await getEntries({
        content_type: 'post',
        'fields.slug[ne]': params.slug,
        order: '-fields.date'
    });

    return {
        props: {
            post: post[0],
            posts
        },
        revalidate: 10
    }
}

export async function getStaticPaths() {
    const slugs = await getSlugs('post');

    const paths = slugs.map((slug) => ({
        params: { slug: slug },
    }));

    return {
        paths,
        fallback: 'blocking'
    };
}
Designly
  • 266
  • 1
  • 9

0 Answers0