updateTag vs revalidateTag #84805
-
|
Don't understand real difference of these both? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 19 replies
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
I should mention that documentation is often far from ideal. Especially now, when we have many changes in behavior. |
Beta Was this translation helpful? Give feedback.
-
|
Both revalidateTag() and updateTag() invalidate cache entries for the given tag, but the key difference is when the data refetch happens. revalidateTag(tag) only marks the data as stale — the refetch and rerender happen on the next navigation or refresh. updateTag(tag) immediately triggers a client-side refetch of all data using that tag and rerenders the current route right away. So: revalidateTag = “invalidate now, update later.” updateTag = “invalidate and update now.” |
Beta Was this translation helpful? Give feedback.
-
|
Sorry for pause, I learned some alternatives like Sveltekit, Nuxt, Asto. Most interesting is Sveltekit. of course, I peronally think that its philosophy far better then Next, but it misses some key features. But this is offtop, I only shuld say KEY thing - documentation of sveltekit is WAY better then next.js, in my opinion. I think expire doesn't apply to render function. And while discussion continues, Next 16 is out. cacheComponent is now stable. What is happened with draftMode? It still exists, but not mentioned Some experiments show that cacheComponents works like this: So I can use db queries and it will NOT be a dynamic data - for example, there exists sync API for SQLite, and it will not treats as dynamic data. That is what I don't like in any documentation - when don't describe logic how it really works, but use some general words with uncertain underground context. Next: |
Beta Was this translation helpful? Give feedback.
-
|
O, ya, about serializable value - it is my mistake. It was serializable values returned from Server Functions, not RSC, as you points to me. Thanks |
Beta Was this translation helpful? Give feedback.
-
|
Ok, but |
Beta Was this translation helpful? Give feedback.
-
|
No-no, how ppr works I understood, documentation is clear at this point. but I think |
Beta Was this translation helpful? Give feedback.
-
|
More important point, I should understand, how much am I wrong in this key points: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
I understood this, but I was wrong about expire - I make conclusion that expire applies and for react component function too. Thanks