filipstefansson
filipstefansson
CCConvex Community
Created by filipstefansson on 12/15/2023 in #support-community
useQuery local cache
In shory, my question is: Do you have anything like this planned:
// first arg is the query key
const result = useQuery(['thread', id], api.threads.get)
// first arg is the query key
const result = useQuery(['thread', id], api.threads.get)
or do we have to roll our own global cache solution?
17 replies
CCConvex Community
Created by filipstefansson on 12/15/2023 in #support-community
useQuery local cache
I guess I could create a useStableQuery but one that writes to a global cache?
17 replies
CCConvex Community
Created by filipstefansson on 12/15/2023 in #support-community
useQuery local cache
Since I'm switching routes, there's a full unmount when I leave the page and then a mount when coming back to the route, so it's not re-renders that's the problem I'm having. useStableQuery does a local cache, but I think I need a global cache. I named the thread "local cache" because I meant on the client and not on the server/db, so sorry for that confusion.
17 replies
CCConvex Community
Created by filipstefansson on 12/15/2023 in #support-community
useQuery local cache
But it sounds like I could achive that using Watch?
17 replies
CCConvex Community
Created by filipstefansson on 12/15/2023 in #support-community
useQuery local cache
Ideally I'd like it to work like react-query, if you make the same query twice (with the same params), it returns the cached data first (from the first query) and then hits the backend. That would help with the flickering when going back to a previously visited page.
17 replies