How to refetch useQuery with different input

Hi! I have a query run with useQuery in a parent component, and in a child component which just contains a react-hook-form with some options for filtering. The tRPC endpoint has some optional inputs for filtering the query, the thing is I want to handle the submit of the filter form in the child component and re run the query but with new inputs added, how can I do that? I tried using the utils from the api.context and using the refetch, but that didn't make my data refresh. Maybe is worth noting that my parent component useQuery is using this flags: refetchOnMount: false, refetchOnReconnect: false, refetchOnWindowFocus: false,
2 Replies
Cobain
CobainOP14mo ago
Nevermind, solved it by creating a zustand store and changing the store from the child component, while the parent component made the query with the input being the store value itself
cje
cje14mo ago
theres no such thing as the same query with different inputs new inputs = new query
Want results from more Discord servers?
Add your server