r/reactjs • u/TkDodo23 • 1d ago
Resource 🗺️ Roadmap to Query v6 · TanStack query · Discussion #12669
https://github.com/TanStack/query/discussions/12669📢 Please don’t get excited, but we’ve started working on TanStack Query v6. We’ll break things, but not too many.
Feedback appreciated 🙏
89
Upvotes
29
u/avoid_pro 1d ago
A question from long time user - we need to standard, most optimal and not bloated way to deal with errors. Right now we can’t figure out one and unified way to handle them. We have tons of teams using query in their own way and errors are handled in completely differently. I personally like to create class component for every error, so I can pass error prop straight to error modal, without doing any extra steps. Others use throwOnError prop but this requires extra code.
What error handling strategy you would suggest so it would fit and could be used by many engineering teams?
7
u/Lumethys 1d ago
Better intergration with real-time tech like Websocket.
Recently i had to do quite a few of real time app, and many of the feature that is realtime would benefit greatly from Tanstack, but it was pretty awkward to use together
3
u/bzBetty 13h ago
So you're allowed to be excited but we aren't?
3
u/sondr3_ 8h ago
This goes for most of the TanStack stuff, but I feel like the docs are slowly deteriorating and it's frustrating how much stuff I have to find in GitHub Discussions or in external blog posts instead of in the docs themselves. Router and Table is in my experience by far the worst, but Query is starting to have the same problems where the guides feel more like API reference docs with notes and are becoming very prescriptive, which makes it really hard to find solutions to things that are just barely off the happy path.
2
u/javatextbook 2h ago
Could you please not let LLMs create docs. Could those always remain human authored
3
u/Kamensky124 23h ago
The removal of the imperative QueryClient methods is what my codebase will feel first in v6. We call ensureQueryData inside route loaders so first navigation resolves from cache without firing a network call, and per the v5 deprecation table those call sites map to query() with staleTime: 'static', while prefetchQuery call sites become query(...).catch(noop). None of that is hard, but dozens of loader call sites each carry their own error handling, so a mechanical migration matters more than the API shape. Are codemods planned for the v6 removals, or should teams budget for hand-auditing every loader call site?
4
u/leoniebuilds 22h ago
on the websocket side, what's worked for a lot of people is not fighting the cache and just pushing socket messages into it with setQueryData, so the query stays the single source of truth:
and set a longer staleTime for those keys so it doesn't refetch on every focus. for events you can't patch cleanly, just call invalidateQueries instead. an official helper for this pattern in v6 would be nice though.
1
u/nikola1970 1d ago
Let's go!