T
TanStack3y ago
stormy-gold

add items in cache manually

Hello, I am dealing with a tree data structure, when the root is fetched, I want to add all individual nodes into the cache, so that when they are updated, only that one is updated
4 Replies
stormy-gold
stormy-goldOP3y ago
e.g i want to cache all ["todos", #] when i fetch "todos"
stormy-gold
stormy-goldOP3y ago
Initial Query Data | TanStack Query Docs
There are many ways to supply initial data for a query to the cache before you need it: Declaratively:
stormy-gold
stormy-goldOP3y ago
i was looking for this OK, no my server is being spammed because I have waay too many nodes and queries, is there a way to disable auto refetching and only fetch when a query key is invalidated?
continuing-cyan
continuing-cyan3y ago
staleTime: Infinity

Did you find this page helpful?