Replies: 3 comments 11 replies
-
|
I made an app where pages with Tested even with middleware activated. What version of Next.js are you using? Can you share a minimal repro where it doesn't work as expected? |
Beta Was this translation helpful? Give feedback.
-
|
Sould no revalidate should rerssintsssinte., u. ^%<@#_
exut#_%_<
…On Wed, Nov 9, 2022, 4:07 PM Joseph ***@***.***> wrote:
I made an app where pages with getStaticProps return props and revalidate
10. As part of props I send a timestamp and then I show that on the page.
With SPA transitions, using next/link I see the revalidated data.
Tested even with middleware activated.
What version of Next.js are you using? Can you share a minimal repro where
it doesn't work as expected?
—
Reply to this email directly, view it on GitHub
<#42685 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4BZRNJ2UB7Z7NAMGUV5PSLWHQG7ZANCNFSM6AAAAAAR3OJQXA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
@sdjnes , has the issue been resolved yet? I am facing the same problem with my project which is using next |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
In discussions/issues, I've found information that ISR revalidation is only triggered on document load of a Next.js page (i.e. directly visiting the URL, or refreshing the page). For many websites and web apps, users land on a homepage and navigate to other pages with links rather than directly going to subpages via a URL.
If page content is pulled from an external service, and changes over time, subpages will show stale content until a refresh or direct visit is made to the page.
In this discussion, it seems that client-side navigation does/did trigger revalidation of pages, however, the examples given there don't work for me as of today.
The ISR documentation is a little ambiguous with the wording: "The only way to invalidate the cache is from someone visiting that page after the minute has passed.". I incorrectly assumed "visiting" would also include client-side navigation, as it's one of those things that I use in the project without much thought and is the recommended way. I'd guess the majority of Next.js projects also use client-side navigation with next/link.
--
Possible solutions
On-demand revalidation
This seems to be the goto stratgey and I believe it works well in some use cases. For example, when content changes in the external service, call an API route in the Next.js application
/api/revalidate?path={path}which revalidates that specific path.However, if there is content that serves multiple pages (e.g. header, footer), this would require many calls to the
revalidate()function in the API route (as there is norevalidateAllPaths()). Deriving the paths can also be an issue, in my case this would require manual work to keep these paths up to date if new non-dynamic routes are added to the repo.Using Vercel, it would be easy to hit the timeout limits for the serverless functions when revalidating many pages.
Use
atags as opposed tonext/linkI think this is likely the best strategy, with some sacrifice to performance.
(Future?)
getStaticPropsin layoutsIf layouts were to support
getStaticPropsin the future, this might solve the above issue of multiple calls torevalidate()for paths, as we could revalidate common page components independently.--
I guess my questions are:
getStaticPropsto be supports in layouts?Beta Was this translation helpful? Give feedback.
All reactions