- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.5k
 
Closed
Closed
Copy link
Labels
Description
Describe the bug
I am facing an issue with Angular Query regarding query.data signal not emitting new value when the query key changes AND there is already data in the cache
In the devtools the active query is updating as expected but the data signal still has the data of the old (now inactive) query
If data is not in the cache it works as expected by calling the query fn and the data signal emits the latest value
Your minimal, reproducible example
https://github.com/shessafridi/angular-query-data-issue
Steps to reproduce
How to reproduce the issue
- Open the browser's console
 - Click the "Search" button
 - You will see a message with the start and end date after 2 seconds
 - Change the date and click the "Search" button again, you should see the message for that date appear as well
 - Now go back to the date you started with and click "Search" again, you will see the query for that date become active again but this time no message is being logged to the console and the UI is still showing the data for the old date
 
Expected behavior
I expect the query.data signal to emit new data when the a new query becomes active
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
OS: Windows 11
Browser: Chrome
Angular Query Version: 5.14.2
Tanstack Query adapter
None
TanStack Query version
5.14.2
TypeScript version
5.2.2
Additional context
No response