I think react-query changes the value of isRefetching to true, and isError to false when you call refetch().
react-query
isRefetching
isError
refetch()
Why not try using error instead of isError?
error