Skip to content

@tanstack/vue-query does not update data after mutation unless isFetching is explicitly used #9133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kostik-noir opened this issue May 9, 2025 · 1 comment

Comments

@kostik-noir
Copy link

Describe the bug

Content is only updated in the component that explicitly uses isFetching in the template

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/4w2vcd

Steps to reproduce

Click "Add" button and compare the content of both UI components

Expected behavior

After clicking the Add button, the contents of both components should be the same.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Browser

Tanstack Query adapter

vue-query

TanStack Query version

v.5.73.0

TypeScript version

^5.73.0

Additional context

No response

@kostik-noir
Copy link
Author

I partially found the reason.

In my example

// src/api.js

export const getItems = () => {
  return Promise.resolve(data);
};

returns a reference to the same array.
If to replace this code with

// src/api.js

export const getItems = () => {
  return Promise.resolve([...data]);
};

which explicitly returns a new instance of Array then everything works as expected without explicit usage of isFetching.

I don't know if it is a bug or a feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants