state change not triggering refetch
I have this query in my app:
When I change the filter parameter, the query refetches as usual.
However, when I change sorting[0].desc, it just doesn't. I've also tried to manually refetch it in a useEffect, but it just fetches with the stale input.
I tried refactoring the direction logic into a useMemo that just returns the string - that does nothing.
Again, I can confirm with a useEffect that the sorting direction does indeed change. It's also kinda weird that it works for filter and not direction.
4 Replies
seems like
direction
is special for useInfiniteQueryCheck you’re not mutating that variable, if the reference stays stable it may not trigger a refetch
I was doing
const direction = useMemo(() => sorting[0]?.desc ? "backward" : "forward", [sorting]) and it didn't work
But what about the setter for that state?