Skip to content
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

Component does not re-render on useQuery data change. #8556

Open
thebishalniroula opened this issue Jan 21, 2025 · 0 comments
Open

Component does not re-render on useQuery data change. #8556

thebishalniroula opened this issue Jan 21, 2025 · 0 comments

Comments

@thebishalniroula
Copy link

Describe the bug

In the example sandbox, i have two components. One uses useQuery with key posts to fetch the posts, and the other one uses useMutation to add the new post and invalidate previous posts queries from the success callback.

The data associated with posts key seems to be updating in the store after query invalidation. (you can check it from the devtools)

But the component that consumed posts query does not seem to re-render for some reason.

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/hqq66p

Steps to reproduce

  1. Open dev tools. (look at the posts query key's data)
  2. Click add post (this adds a new post and invalidates posts queries)

Expected behavior

The data associated with posts key updates in the devtools. Hence a rerender in the component consuming posts is expected. But it clearly is not happening in this case.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OS: Macos
Browser: Brave

Tanstack Query adapter

react-query

TanStack Query version

5.64.2

TypeScript version

No response

Additional context

No response

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

No branches or pull requests

1 participant