You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can I use this to cache client loader data too? #6
This is working great for server data - but in my usecase I am fetching data in the client loader that I also want to cache. Below is some rough code of what I'm trying to do - is this possible?
yes it is possible, there are concepts of adapters which you can use to cache the data, for example the library exports a cache export which is used by default and allows you to setItem in it, for example you could do:
exportasyncfunctionclientLoader(args: ClientLoaderFunctionArgs){// cache from the server loaderconstserver=awaitcacheClientLoader(args,{type: 'swr',})// your code that is caching and fetching something on the clientconstwhiteboards=cache.getItem("whiteboards") ? cache.getItem("whiteboards") : awaitgetAllLocalWhiteboards()return{
...server,
whiteboards,}}
Activity
AlemTuzlak commentedon Sep 17, 2024
yes it is possible, there are concepts of adapters which you can use to cache the data, for example the library exports a
cacheexport which is used by default and allows you to setItem in it, for example you could do: