Next.js Discord

Discord Forum

Prevent getStaticProps from running multiple times

Unanswered
Satin posted this in #help-forum
Open in Discord
SatinOP
My app calls the GPT API to generate content on demand when a page is first loaded, and thanks to getStaticProps subsequent loads will return a static page with that same content.

My problem is, if a page is requested multiple times before getStaticProps has finished, it will generate different content for each request.

How can I exit out of getStaticProps if another request has already started generating the content?

Thanks!

0 Replies