简体   繁体   中英

Next.js Incremental Static Regeneration not reflecting changes without reloading the page

Trying to implement Incremental Static Regeneration on a Next.js project.

There is an index page with a list of posts using revalidate: 1 on getStaticProps() .

On a different page, there is a form used to edit the post title. This pages makes an AJAX call to an API endpoint that updates the record on the database.

After editing a post title, I go back to the page with the posts list, using next/link , but the list shows outdated data. If I reload the page I still see outdated data, but as soon as I click the link to the posts list page again, the data is updated.

Am I missing something or this is the expected behaviour?

Here is a repo replicating this scenario (uses "product" instead of "post"):

This appears to be expected behavior ( https://youtu.be/yGuN_9rng6o?t=806 ). On a new request (when you reload), Next.js will first serve the old page but start generating the new page so that the next request will be updated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM