Replies: 3 comments 7 replies
-
I can expose a primitive API from waku/minimal/client, and waku/router/client should provide the user facing API. Having that said: Is it correct that your requirement is to cache "dynamic pages" or "dynamic elements"? Because, we never invalidate static pages/elements (which should return the same content anyway.)
That's tricky, right? What should the user-facing api look like in your mind? Another concern of mine is that cache should be controlled from the server not from the client, as the server should have more knowledge about the data lifetime. |
Beta Was this translation helpful? Give feedback.
-
That makes more sense to me. Though, the problem is slightly different from cache control in general. It's stale-while-revalidate only.
I see. Good point. We could see if defaulting to s-w-r for navigating to back. Though, it feels tricky because s-w-r kills React Suspense. |
Beta Was this translation helpful? Give feedback.
-
Here are some more thoughts on how this could work. |
Beta Was this translation helpful? Give feedback.
-
I see that the waku/minimal/client includes some caching - but I think it is created on each render or prefetch process and then deleted afterwards.
It might be useful to be able to cache an RSC response and do invalidation and automatic re-fetches. A lot of the same options for TanStack Query would apply (staleTime, gcTime, networkMode, etc).
This could be applied to pages, layouts - and nested elements?
I don't think TanStack Router has a way to add caching. (This article on preloading)[https://tanstack.com/router/latest/docs/framework/react/guide/preloading#how-long-does-preloaded-data-stay-in-memory] says:
I wonder if leveraging @tanstack/query-core in a waku client implementation is a good idea.
Beta Was this translation helpful? Give feedback.
All reactions