Skip to content

Component will render even when query fails #17

Closed
@imp-dance

Description

@imp-dance

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:

  1. Mount a component with a loader that has a query that fails
  2. Unmount the component
  3. Remount the component
  4. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions