Closed
Description
Describe the bug
When a component that has a loader with a failed query is remounted after the first time - it will render even if it does not have a successful response.
To Reproduce
Steps to reproduce the behavior:
- Mount a component with a loader that has a query that fails
- Unmount the component
- Remount the component
- See error
Expected behavior
Component should enter onError state
Actual behavior
Component enters success state
Additional context
Seems to be a change in rtk toolkit introduced somewhere between version 2.2.3
and 2.2.5
that makes it so that a query can be in the following state:
{
isError: false,
error: { error_object: "foobar" },
isFetching: true,
...rest
}
Notably, isError
is false because it is retrying/refetching. This state could be derived as:
const isError = query.isError || (query.isFetching && query.error && !query.data)
Metadata
Metadata
Assignees
Labels
No labels