-
As an example, suppose we have a const city = useSelectedCity();
const temp = useCityTemp(city); // high frequency feed, every 1s.
const { data: healthRisk } = useQuery({
queryKey: [city, temp],
queryFn: async () => getRisk(city, temp),
}); Is there a way to debounce this in a way such that the health risk is fetched at most once per minute, but immediately when the user selects a new city? Or is there a better way to compose these pieces of data to achieve the desired effect? |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
May 8, 2025
Replies: 1 comment
-
you need to debounce the value that goes into the queryKey yourself. I talked about this here: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
aryzing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you need to debounce the value that goes into the queryKey yourself. I talked about this here:
https://www.youtube.com/watch?v=l3PxErcKeAI&t=1024s