Replies: 1 comment
-
now we can see that I just realized that calculating |
Beta Was this translation helpful? Give feedback.
0 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.
-
How can one deal with the problem of useInfiniteQuery's
queryFn
depending on data fromuseQuery
when doing CRUD operations?Specifically, I have a custom hook that returns a list of all document ids (and other metadata) that allows for various sorting of the data client side before rendering it:
The dependent query is a component:
Then, I use the pagination function
fetchNext
as the input touseInfiniteQuery
. This works fantastically until I have a mutation that runsinvalidateQuery
on['collection', collection, 'ids']
. In that case,data
is updated within the custom hook, butfetchNext
, when called asqueryFn
foruseInfiniteQuery
, does not have access to the updated value ofdata
.I have considered passing all of the document ids to
useInfiniteQuery
, but that precludes an optimistic updateonMutation
using the same query key.I have noticed that
fetchNext
is updated any time I load a new page. Is there any way to trigger the updating offetchNext
so that its internal variable represents the new value ofdata
or to pass that value in (I have triedmeta
, but it too does not update)?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions