Skip to content

Replace isLoading with isPending for query usages #126

Description

@harryrigg

Tanstack Query official docs recommend using isPending for checking query status, rather than isLoading (https://tanstack.com/query/latest/docs/framework/react/guides/queries).

The reason for this is because checking both isError and isLoading does not actually guarantee that the data will be available. However, after isError and isPending are both checked to be false, typescript will actually narrow the type of the query data so that a check for undefined is no longer required.

Some components still use isLoading to check query status, this should be changed to isPending, and any remaining checks for the data being undefined should be removed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions