Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace isLoading with isPending for query usages #126

Open
harryrigg opened this issue Nov 3, 2024 · 0 comments
Open

Replace isLoading with isPending for query usages #126

harryrigg opened this issue Nov 3, 2024 · 0 comments
Labels
difficulty:medium enhancement New feature or request frontend Task must have a front end issue

Comments

@harryrigg
Copy link
Collaborator

harryrigg commented Nov 3, 2024

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.

@harryrigg harryrigg added enhancement New feature or request frontend Task must have a front end issue difficulty:medium labels Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:medium enhancement New feature or request frontend Task must have a front end issue
Projects
None yet
Development

No branches or pull requests

1 participant