Skip to content

useQuery return always isLoading with true when enabled is false #3975

@aXenDeveloper

Description

@aXenDeveloper

Describe the bug

When I created useQuery with enabled: false option, isLoading variable is always true.

Your minimal, reproducible example

https://codesandbox.io/s/react-query-enabled-7u58d5-7u58d5

Steps to reproduce

  1. Create simple query by use useQuery,
  2. Add enabled: false into options,
  3. Check state for isLoading.

Expected behavior

State isLoading is false.

How often does this bug happen?

Every time

Screenshots or Videos

image

Platform

  • OS: Windows 11 22H2,
  • Browser: Chrome
  • Version: 103

react-query version

4.0.10

TypeScript version

4.7.4

Additional context

No response

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