Skip to content

invalidateQueries with refetchActive: false on inactive query refetches it #2271

@donysukardi

Description

@donysukardi

Describe the bug
Calling queryClient.invalidateQueries with { refetchActive: false } on inactive query actually refetches it.

To Reproduce
Codesandbox: https://codesandbox.io/s/react-query-refetchactive-bug-n3kwc

With the following query cache state:

['queryA'] // inactive
['queryB'] // active

When I call

// ❌ Incorrect, refetches 😵
queryClient.invalidateQueries(['queryA'], {
  refetchActive: false
});

// ✅ Correct, doesn't refetch
queryClient.invalidateQueries(['queryB'], {
  refetchActive: false
});

Expected behavior
Option { refetchActive: false } on inactive query shouldn't trigger refetch

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: chrome
  • Version: 90

Additional context
N.A

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