All these observations are about what happen in production. You can read more about ISR on the next site here:
npm run build; npm start
The behavior in dev mode
npm run dev is not important regarding production deployment or this post.
Say you have a page that lists 100 product links. As soon as your customer’s browser hits that page, the static content of that page is immediately downloaded. This is good. However, at the same time, your browser is also requesting all the props associated with every link on your page. For a page I’m working on that each link goes to a speaker detail page, the size of the props in total for each speaker is about 25K. 200 speakers, that’s .5 Megabytes. If my customer views this on a mobile phone, that could add up fast when all they really wanted was a few bytes.
When you return from
getStaticProps `notfound: true, then the first time this page is rendered, a status 304 (redirect) is returned. NextJS then,
somehow updates the code on the server (I’ve not figured out how) so that the next time this page is hit you get a 404 (file not found). You can
Below is where you set
It seems that what is triggering the regen of the page is the client’s browser and not anything on the server. That makes sense since there may be just a CDN or static server, there is no way for that server to let your actual node server regenerate a new page. Seems obvious now but only after I observed the behavior.