next-learn
next-learn copied to clipboard
Chapter 8: Question to the use of unstable_noStore() inside data access functions.
Hi all,
From the docs:
unstable_noStore can be used to declaratively opt out of static rendering and indicate a particular component should not be cached.
In the tutorial, we use unstable_noStore()
inside data access functions. Not inside components, as the docs imply. Basically, we force components, using the data access functions, to dynamic rendering.
Wouldn't it be better to make this behavior explicit at the component level in @/app/dashboard/page.tsx
?
Meanwhile, I passed chapter 12. Probably it needs some experience to find the right level for placing noStore
and caching actions.
If my understanding is correct, the tutorial aligns with API functions like cookies
, headers
and others. Using these functions opt routes into dynamic rendering. The same as the data access functions with unstable_noStore()
do. Similar, Server Actions in chapter 12 trigger redirects and cache revalidations.
An easier way to think about this is it controls the data sent from server. It can be whole component or methods that fetch data. unstable_noStore()
tells Next.js which data to recompute again.