Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NextJS: getStaticProps revalidate not working

I have this NextJS site where there is this getStaticProps that load data from Firestore.

I have this:

return {
    props: {
      allPosts: posts,
    },
    revalidate: 60,
  }

where from what I know will load data from firebase every one minute. However, it doesn't seem to work and data are just not updated.

Is this revalidate an experimental feature? Anyway that I can get it to work? Else I would have to rebuild and export frequently.

like image 461
Daryl Wong Avatar asked Feb 12 '21 02:02

Daryl Wong


1 Answers

If you want Incremental Static Regeneration (basically revalidate flag for getStaticProps) then you need to run Next.js server (next start command), without the server there is nothing that could perform requests, update data and generate new static files.

next export only generates static files once, with the data that was available at the build time.

like image 157
Danila Avatar answered Nov 12 '22 03:11

Danila