#getStaticProps not being called :c

5 messages · Page 1 of 1 (latest)

waxen blade
#

i'm trying to run getstaticprops but its not getting called

import { client } from '@/sanity/lib/client';
import { GalleryImageList } from '@/components/GalleryImageList';

interface Gallery {
    _id: string;
    images: Image[];
}

interface GalleryPageProps {
    gallery: Gallery;
}

const Gallery = ({ gallery }: GalleryPageProps) => {
    return (
        <div>
            <GalleryImageList gallery={gallery} />
        </div>
    );
};

export async function getStaticProps() {
    const gallery = await client.fetch(`*[_type=="gallery"][0]{title, images}`);

    return {
        props: {
            gallery,
        },
    };
}

export default Gallery;
#

Folder layout

#

ah wait, you can't use getstaticprops in the app folder

#

i figured it out

#

sad_cry i wasted so much time on this