v5: solid-query key and data mismatch with `staleTime` set #5738
Send to my agentDescribe the bug#
There's data and key mismatch with staleTime configured using Solid Query v5 (only v5, v4 works as expected). In another setup (not the reproduction), the mismatch always happens whether staleTime is set or not.
Your minimal, reproducible example#
https://stackblitz.com/edit/solid-query-key-and-data-mismatch
Steps to reproduce#
- Go to the StackBlitz reproduction
- Wait for the dependencies installation and server to start
- Initially the
selectoption set toOneand the fetching starts for the key['posts', '1'] - Change the
selectoption toTwoto fetch for['posts', '2']and the data below it will update - Switch to option
Onewith['posts', '1'], the data will change as expected - Switch back to option
Twowith['posts', '2']but it will keep showing data for key['posts', '1']⚠️
Expected behavior#
Switching between the two keys should return the data corresponding to each key.
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
- OS: macOS
- Browser: Brave (Chromium-based)
- Version: Brave
v1.52.130Chromiumv114.0.5735.198
Tanstack Query adapter#
solid-query
TanStack Query version#
v5.0.0-alpha.85
TypeScript version#
v5.1.3
Additional context#
No response
TkDodo added labelsbug
TkDodo added labelspackage: solid-query
TkDodo added labelsv5
This is a bug in the
reconcilebehavior. If you setreconcile: falsein createQuery Option it should work as expectedThanks for your replies @TkDodo @ardeora. Indeed, disabling the
reconcileoption solves the data/key mismatch issue I had.Do you think that the
reconcilebug could potentially cause other unexpected issues? If it makes sense to disable it globally until it's resolved.I was testing
v5today and using a query with arefetchIntervalwith acreateEffectthat usesquery.data, the effect was not being called on each fetch but it was inv4, I solved it by settingreconciletofalse, so I just wanted to let you know about it.Should be fixed in the new versions and up! v5.0.0-rc.8 If you could please update your dependency and check if it works as expected, that would be awesome :D
Here is the reproduction with the new version https://stackblitz.com/edit/solid-query-key-and-data-mismatch-wjjhsu?file=package.json
ardeora(GitHub profile, opens in a new tab) closed this
It's working as expected yes, thanks for the update!
Sign in to join this conversation.
hmm, this seems to work in v4. @ardeora do you think this is solid specific?
working v4 reproduction