Replies: 2 comments 2 replies
-
Not sure I fully understand the use-case, but if you want normalized caching, have a look at normy: |
Beta Was this translation helpful? Give feedback.
0 replies
-
This looks interesting and I will definitely have a look. Reading back my question, I did not do a good job explaining what I wanted to achieve - tl;dr, if there is a "detailed" version of a resource, I want to use it in the "list" version of the resource. Currently, when something is updated, I need to invalidate the entire list of resources in order to get the latest version of the resource. |
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey. Imagine there is a query like:
And another one like:
The UI presents a list of books and when the user picks one, we fetch the detailed data it.
I'm wondering if there is a way to use the detailed book data for the list of books query? The use case is that, when a book is updated, a server-sent event is received and we need to invalidate the data - we can either invalidate the entire books query, or we can invalidate the data for that individual book only and replace it in the cache. The problem is that, if the user never opened that book's details, there is no individual book query to invalidate.
Is this a total misuse of TanStack Query or is it a legit use case?
Beta Was this translation helpful? Give feedback.
All reactions