Skip to content

Disabled queries (enabled: false) get affected by invalidateQueries (refetchInactive: true) #3202

Closed
@nikkizol

Description

@nikkizol

Describe the bug

queryClient.invalidateQueries(queryKey, { refetchInactive: true, })
also refetches disabled queries (enabled: false)

but - #947 (comment)

looks like this issue was introduce in this commit - f5ae636

Your minimal, reproducible example

https://codesandbox.io/s/quiet-dust-hegny?file=/src/App.js

Steps to reproduce

  1. Create a query with useQuery and set enabled option to false.
  2. Invalidate this query with invalidateQueries and set refetchInactive to true

Expected behavior

I expected that disabled queries (enabled: false) would not refetch when I use invalidateQueries

Platform

  • OS: macOs
  • Browser: Not related

react-query version

v3.34.8

TypeScript version

v4.2.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions