Replies: 1 comment
-
I also have a question about |
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
-
I have a query that must provide data automatically when the component initializes. The query key updates after submitting the form data, but instead of immediately fetching data from the backend, I plan to update the query data at the appropriate time using the approach below.
setQueryData
method fromQueryClient
is used to create new cache data for the updated query key after submission.refetch
method from useQuery is used to enable the reloading feature.I have decided to disable the query after its first fetch is successful, preventing it from running automatically even if the query key updates later. Please check the sample code:
Is that okay for you, or do you have other suggestions? thanks for helping!
Beta Was this translation helpful? Give feedback.
All reactions