Skip to content

fix(core): pass invalidationOptions as options arg to queryClient.invalidateQueries - #7680

Open
nilesh0002 wants to merge 1 commit into
refinedev:mainfrom
nilesh0002:fix/use-invalidate-options
Open

nilesh0002 wants to merge 1 commit into
refinedev:mainfrom
nilesh0002:fix/use-invalidate-options

Conversation

@nilesh0002

Copy link
Copy Markdown

Description

Fixes a bug where invalidationOptions was merged into the filters object passed to queryClient.invalidateQueries, instead of being passed as TanStack Query v5's second options argument.

TanStack Query v5 signature: invalidateQueries(filters?, options?)

cancelRefetch is only read from options, so Refine's default invalidationOptions = { cancelRefetch: false } was silently ignored, causing all invalidations to run with TanStack's default cancelRefetch: true.

Changes

  • Separated invalidationOptions from query filters in all 5 switch-case branches (all, list, many, resourceAll, detail)
  • Updated existing test assertions to verify two-argument call signature
  • Added new test case for custom invalidationOptions
  • Added changeset

Closes #7656

…alidateQueries

TanStack Query v5 signature: invalidateQueries(filters?, options?)
cancelRefetch is only read from options, so spreading invalidationOptions
into the filters object silently ignored it.

Closes refinedev#7656
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bb186bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] useInvalidate passes invalidationOptions as query filters, so cancelRefetch is ignored

1 participant