codersforcauses / codersforcauses/coexist

Replace `isLoading` with `isPending` for query usages

Open
#126 0 comments 0 reactions 0 assignees View on GitHub
difficulty:medium enhancement frontend
Dominant language
TypeScript
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.