Replies: 1 comment 3 replies
-
I'm not quite sure I follow your situation / problem completely. Ad 1, you could just disable garbage collection for query A by setting a higher Ad 2 if query B depends on queryA, the data it depends on should go to the query key, as per usual. The dependent queries section in the docs shows that quite nicely, and I would just put the two things into a custom hook so that the GC issue doesn't even arise because as long as queryB is used (which uses query A, query A will also be used):
In this example, if |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
the thing that I'm trying to achieve is:
we have query A - fetches some data.
and query B - it query function uses the data from query A (lets say by calling fetchQuery).
there are a few issues here:
to solve (2) I can use cache onSuccess callback and invalidate query B - this is kinda nice cause I can maintain a static registration of dependencies.
but this won't solve (1)
QueryObserver
should solve both, but there are a few problems here:in general, I think it could be nice if there was a way to declare dependencies between queries - say that query B is observing query A and should be invalidated whenever the data of query A is changed.
Beta Was this translation helpful? Give feedback.
All reactions