Fire trpc useQuery only when a callback is called
I have kind of a weird use case. I would like to run a trpc useQuery() only when a callback is called. This callback is triggered by a push notification so I don't want the query to update on its own, only when the callback fires.
How can i do this?
2 Replies
I currently have the following:
this mostly works but i would like to prevent the 'refresh when changing windows' behavior
You should be able to accomplish this using 2 things.
1. Set
enabled: false
in the query options
2. Call tournamentQuery.refetch
in your useEffect
when your condition is true