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