shared cache? #3319
Unanswered
tamis-laan
asked this question in
Q&A
shared cache?
#3319
Replies: 1 comment 2 replies
-
yes, they do. That's part of the concept and often not a problem. List views often have a different structure than detail views and are not 1:1 copyable. React-Query doesn't have a schema or a normalized cache so having "duplicated" data in the cache is one of the tradeoffs.
Instead of "pushing" data down in |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have two query hooks, let's cal them
useTodo
anduseTodos
. The first one fetches a single todo by id and the second one fetches multiple todos by ids.The thing here is that I don't want to reload a todo when useing the
useTodo
hook when the todo is already loaded byuseTodos
. Currently I'm using the query client to update the data of each todo afteruseTodos
is done fetching:This works but only solves part of the problem. The first problem is that the same todo's now live twice in memory. Once for the
useTodos
and another for eachtuseTodo
. Second it only works one way,useTodos
updates eachuseTodo
but not the other way arround. The same problem occures withuseInfiniteQuery
.Is there some way to make this more efficient?
Beta Was this translation helpful? Give feedback.
All reactions