- Turn on
keepPreviousData: true
- Template using
isError, not error, to detect an error state
- Fire a query that resolves and displays normally
- Fire a query that fails and introduces an error state
- The
isError state is false, but there is clearly an error present.
I think the desired effect is that if an error is encountered in the new/latest query, the status should not be success with the previous data, but error with the new query.
Codesandbox: https://codesandbox.io/s/optimistic-hooks-n5v12?file=/src/index.js