TanStack

T

TanStack

TanStack is a community of passionate software engineers striving for high-quality, open-source software for web devs

Join

react-query-questions

solid-query-questions

table-questions

virtual-questions

router-questions

react-charts-questions

ranger-questions

vue-query-questions

svelte-query-questions

bling-questions

form-questions

angular-query-questions

start-questions

db-questions

start-showcase

router-showcase

📣-announcements

harsh-harlequin
harsh-harlequin11/2/2025

How to prefetch in server component inside next 16.0.1

Hello I have this server component ``` import { QueryClient, HydrationBoundary,...
xenial-black
xenial-black11/2/2025

How can I keep query data accessible in all place of the App?

I can only use useQuery within a React context. This hook is super useful for fetching core app data (like configs, user info, etc.). However, I’m struggling with how to access this data across the app — for example, I need the user ID in request headers or for analytics tracking. Currently, I see two options:...
evident-indigo
evident-indigo11/2/2025

Performance question

At my company, we have a few different blockers for data fetching - we use our own internal package manager and “repackage” external ones if approved by infra. We use Apollo (older version) and a wrapped Apollo for rest endpoints. My team “vendored” react query because we had specific use cases that required the granular control it gives and decided to stick with it. My question is, I know Apollo eats at performance over time calling their hooks (at least in the version we use). Does react query have the same issue depending on the observers? Or when would it make sense to pass the data as props vs calling the hooks we create to manage the fetching? We have some places where the query options would change, specifically the select option, but we already suffer from perf issues in our app we’re trying to resolve, and as I’m rearchitecting our component structure I want to make sure I’m not adding a “death by 1000 cuts” scenario 🙂...
adverse-sapphire
adverse-sapphire10/31/2025

useMutation weird issue with server actions

guys, weird question but before some days, some mutations stopped working locally (not sure why it hasn't happend before). I am a bit confused as to why this example doesn't fire the server action (a file that export loginAction and is marked with 'use server' (I don't like it too Tanner 🙂 ))
const loginMutation = useMutation({ mutationFn: loginAction });
const loginMutation = useMutation({ mutationFn: loginAction });
...
grumpy-cyan
grumpy-cyan10/30/2025

How to handle old (now) invalid persisted data?

I am using the tanstack query's persist plugin to persist queries on filesystem. What's a proper approach for handling old data (coming from an API) missing fields that are now available in the API? Should I just consider all new fields as optional and check for their existence before rendering? Should I just invalidate the persisted cache? (I'd rather avoid this, as I cannot seem to cache bust only 1 query, I have to bust the whole cache when 1 singular query is wrong)...
extended-salmon
extended-salmon10/30/2025

Typing of data for useQuery when placeholder data is set?

Something I noticed recently is that when using placeholder data, the return type of useQuery in the react package is undefined. This seems counter intuitive? I would expect that with a static object in placeholderData that the return type of data would be defined. Further, in my very basic testing it is always defined? TS Playground...
No description
national-gold
national-gold10/29/2025

invalidate vs refetch

Say this post in twitter 1: is it safe to use refetch this way when available ? 2: and bring the whole const queryClient = useQueryClient() only when invalidating queries not available in the current components? 3: which bring me to another question that is the difference between queryClient.refetchQueriesand queryClient.invalidateQueries?...
No description
inc-lavender
inc-lavender10/28/2025

How to let query be garbage collected but remain in indexddb

And restore the query from indexeddb for it's initialData. I am developing an application that needs a massive amount of data client side
inland-turquoise
inland-turquoise10/27/2025

Looking for work as a Frontend developer

As an Angular/Vue.js developer with 6 years' experience, I craft fast web apps using RxJS/NgRx and Composition API/Pinia for state management. Modern TypeScript/JavaScript drives these implementations, paired with MUI/Tailwind CSS for polished interfaces. Seamless REST/GraphQL API connections bridge to backends, occasionally enhanced with Node.js/.NET support and SQL/MongoDB databases. Recent projects incorporate AI tools like OpenAI/ChatGPT for smart features in Angular/Vue environments....
optimistic-gold
optimistic-gold10/27/2025

Is it safe to store jwt token in tanstack-query

Hi i just Wanted to know if it is safe to store jwt token in tanstack-query ? .. I am not using query persister so it will not be stored in local storage
genetic-orange
genetic-orange10/26/2025

Looking for realworld or good examples code of using Tanstack Query for Angular

I would appreciate examples of correct usage (such as in code structure, files, and architecture, best practices) of Tanstack Query for Angular. Thank you in advance for your help....
exotic-emerald
exotic-emerald10/25/2025

Weird behavior with "useIsMutating" hook

I was playing with this hook and wondering if this is intended: I fired multiple mutations ( let's say 6 ) with the same scope.id ( to make them queue ) and with onSuccess callback that just logs what useIsMutating returns. So I am getting a log every time a mutation from the queue is finished, but all my logs are "0" and only the last one logs "1". ...
No description
continuing-cyan
continuing-cyan10/25/2025

Only update affected post in infinite feed?

Imagine the following scenario: 1. user visits a page w/ an infinite posts feed 2. user scrolls down for a while, see a post they like, and upvote it 3. only the relevant data updates & only the relevant component re-renders...
No description
rising-crimson
rising-crimson10/25/2025

React query hanging in react native (expo)

I have been trying to debug this for quite a few hours now and I am stumped. I am seeing a useQuery hang right before it gets to a db query, but only the first time. It eventually returns data, but only after like 30+ seconds. I am using the react native debugger and have confirmed that the network calls themselves are very short, like 100-200ms once they actually fire. But for some reason the useQuery refuses to return the data quickly. I have also added a fetch() in there and I can see the fetch call complete in the debugger, but the console.logs I have right after wont log until like 30 seconds after....
rival-black
rival-black10/24/2025

streamedQuery increase default timeout

Hello it's there a way to increase streamedQuery or useQuery default timeout? I've got a SSE response which takes more than 30 seconds
national-gold
national-gold10/22/2025

Caching from UseMutation Help

hey guys i need some advice on how to go about this im currently running a mutation to summarise a post and onSuccess im setting the data in the queryCache by a key and post.id etc and this is all in a custom hook which i import into the parent component so i can access the mutate...
wise-white
wise-white10/21/2025

Error handling with SSR and suspense queries on tanstack start

Hi, I'm using (for the first time, with no experience with this framework) Tanstack Start, paired with Tanstack Query. I followed the official example I found in tanstack start documentation to properly configure and use query in an SSR enviroment. When the queries correctly returns data there are no problems. However if the query fails (in my case, the rest API I'm calling can throw an error) while running on server I have an hydration error:...
xenogeneic-maroon
xenogeneic-maroon10/21/2025

Is it possible to suspend with useSuspenseQuery for all fetches?

I have an updating value that should refetch and I have that as the 2nd queryKey. I want it so that anytime this value is updated, the component suspends. I think the article below has a solution for the useQuery hook, but I want to do something similar with useSuspenseQuery. Checking inside of the component with useIsFetching and returning the suspense fallback doesn't seem like a clean solution to this. https://tanstack.com/query/latest/docs/framework/react/guides/background-fetching-indicators...
noble-gold
noble-gold10/20/2025

Using Tanstack Query for the Update page on CRUD operations

Hi, I'm looking to shift my application from using regular fetch to tanstack query and looking to update my CRUD pages. For a create operation this is more straight forward but I'm curious what sort of pattern people use with tanstack query since this has generally eliminated the need for my query to be within useEffect with. Previously I would have just done my operation inside a useEffect block which uses the set functions from useState to set the values to be displayed in ...
probable-pink
probable-pink10/16/2025

No mutationFn found (offline)

```tsx // Responsible for resuming paused mutations export const SyncPausedMutations = () => { const queryClient = useQueryClient(); const createIssueMutationOptions = useCreateIssueMutationOptions();...