query icon indicating copy to clipboard operation
query copied to clipboard

fix(vue-query): invalidate queries immediately after call `invalidateQueries`

Open Mini-ghost opened this issue 1 year ago β€’ 3 comments

Resolve #7694

Originally, when we called queryClient.invalidateQueries from @tanstack/vue-query, it would trigger invalidateQueries from @tanstack/query-core in the next macro task.

This was initially intended to fix issue #6414, but it caused an inconsistency with the documentation. Users would receive unexpected values when reading query.isInvalidated after calling queryClient.invalidateQueries.

In this PR, we have deferred only the internal call to refetchQueries within queryClient.invalidateQueries, ensuring that the state changes immediately without affecting the parameters received by the queryFn.

cc: @kazcw

Mini-ghost avatar Aug 21 '24 00:08 Mini-ghost

☁️ Nx Cloud Report

CI is running/has finished running commands for commit f7af52dd3e382a643dac91ef52c8242d60a54a63. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

πŸ“‚ See all runs for this CI Pipeline Execution


βœ… Successfully ran 2 targets

Sent with πŸ’Œ from NxCloud.

nx-cloud[bot] avatar Aug 21 '24 00:08 nx-cloud[bot]

commit: f7af52d

@tanstack/angular-query-devtools-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@7930
@tanstack/angular-query-experimental

pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@7930
@tanstack/eslint-plugin-query

pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@7930
@tanstack/query-async-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@7930
@tanstack/query-broadcast-client-experimental

pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@7930
@tanstack/query-core

pnpm add https://pkg.pr.new/@tanstack/query-core@7930
@tanstack/query-devtools

pnpm add https://pkg.pr.new/@tanstack/query-devtools@7930
@tanstack/query-persist-client-core

pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@7930
@tanstack/query-sync-storage-persister

pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@7930
@tanstack/react-query

pnpm add https://pkg.pr.new/@tanstack/react-query@7930
@tanstack/react-query-devtools

pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@7930
@tanstack/react-query-next-experimental

pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@7930
@tanstack/react-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@7930
@tanstack/solid-query

pnpm add https://pkg.pr.new/@tanstack/solid-query@7930
@tanstack/solid-query-devtools

pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@7930
@tanstack/solid-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@7930
@tanstack/svelte-query

pnpm add https://pkg.pr.new/@tanstack/svelte-query@7930
@tanstack/svelte-query-devtools

pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@7930
@tanstack/svelte-query-persist-client

pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@7930
@tanstack/vue-query

pnpm add https://pkg.pr.new/@tanstack/vue-query@7930
@tanstack/vue-query-devtools

pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@7930

Open in Stackblitz

More templates

pkg-pr-new[bot] avatar Aug 21 '24 00:08 pkg-pr-new[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.94%. Comparing base (4977296) to head (f7af52d). Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           main    #7930       +/-   ##
=========================================
+ Coverage      0   71.94%   +71.94%     
=========================================
  Files         0       19       +19     
  Lines         0      467      +467     
  Branches      0      121      +121     
=========================================
+ Hits          0      336      +336     
- Misses        0      101      +101     
- Partials      0       30       +30     
Components Coverage Ξ”
@tanstack/angular-query-devtools-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/angular-query-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/eslint-plugin-query βˆ… <ΓΈ> (βˆ…)
@tanstack/query-async-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/query-broadcast-client-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/query-codemods βˆ… <ΓΈ> (βˆ…)
@tanstack/query-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/query-persist-client-core βˆ… <ΓΈ> (βˆ…)
@tanstack/query-sync-storage-persister βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-next-experimental βˆ… <ΓΈ> (βˆ…)
@tanstack/react-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/solid-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-devtools βˆ… <ΓΈ> (βˆ…)
@tanstack/svelte-query-persist-client βˆ… <ΓΈ> (βˆ…)
@tanstack/vue-query 71.94% <100.00%> (βˆ…)
@tanstack/vue-query-devtools βˆ… <ΓΈ> (βˆ…)

codecov[bot] avatar Aug 21 '24 00:08 codecov[bot]