using mutation and useQuery together on post api #4711
Unanswered
dante01yoon
asked this question in
Q&A
Replies: 1 comment
-
queries that are Mutations are not meant for data fetching. The result of your mutation also never makes it into the query cache, because you'd need to manually put it there. What you are likely looking for is lazy queries: |
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.
-
Greetings,
Is this normal case using useMutate, useQuery together in single component?
data should be fetched manually using mutation (click button),
but should be cached and viable later with out fetch if data is cached.
so here is how I organize code.
the problem is queryInfos returned by
usePostData
keep sayingstatus: 'loading', fetchStatus: 'idle', isLoading: true, isSuccess: false, isError: false, ...
and seems this query doesn't be invalidated after onSuccess callback called in
usePostData
.is this happened because of
enabled: false
?Beta Was this translation helpful? Give feedback.
All reactions