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

conscious-sapphire
conscious-sapphire9/30/2025

router.tsx for Convex + Start RC

I wonder if it is correct to nest <ConvexAuthProvider> as a child of <QueryClientProvider>. Is it redundant? deps: ```json "@convex-dev/auth": "^0.0.90",...
ambitious-aqua
ambitious-aqua9/30/2025

Worrying about optimistic Update performance in UseInfiniteQuery

hey guys so my worry is basically the title, im using an InifiniteQuery that will fetch posts from the backend database using Pagination! Now the infinitequery handles all in 1 now what i mean by that is it takes into account 1) keyword filtering 2) sorting + score filtering ...
conscious-sapphire
conscious-sapphire9/30/2025

How can I tell if my query cache is being used successfully?

How can I tell if my query cache is being used successfully? If I set a staleTime of 60 minutes I still see it taking 110ms to complete if I navigate to another page/route and then come back (or just refresh the page). Is it only saving me if my javascript on the same page was going to request again on some timer or does it save me on page loads like this? ```js...
itchy-amethyst
itchy-amethyst9/24/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....
stormy-gold
stormy-gold9/23/2025

invalidateQueries does not work as expected

I have three different use cases of invalidateQueries, add user, ban/unban user and delete user, when I perform one of those actions it does not trigger a re-render, until I use removeQueries + refetchQueries for it to work ```ts const createUserForm = useAppForm({ defaultValues: { email: '',...
fascinating-indigo
fascinating-indigo9/22/2025

Caching for fetching multiple ids in different batches

Hi, I would like to know if something like this is already build-in or doable wihout building a new feature. Context:...
wise-white
wise-white9/22/2025

"No QueryClient set" after react-query update to 5.85.6.

Hey 👋🏽 today I updated my react-query dependency in a react app from 5.85.5 to 5.90.1, which uses tanstack/react-router. Suddenly I get "No QueryClient set, use QueryClientProvider to set one errors, but only in production (what bit me 😅 ). I also noticed that the bundle size has been increased by 10 kb (unzipped). ...
eastern-cyan
eastern-cyan9/22/2025

context.client undefined in react query V5

The docs indicate that the onMutate option in the useMutation hook should be a context item that contains the query client. That would then allow us to use something like context.client.setQueryDate without calling queryClient = useQueryClient(). ```jsx onMutate: async (updatedFailureMode) => { await queryClient.cancelQueries({...
conscious-sapphire
conscious-sapphire9/20/2025

Docs: Optimistic Updates issue

Hi everyone! I have an issue with optimistic docs example. In docs it says the following:
To do this, useMutation's onMutate handler option allows you to return a value that will later be passed to both onError and onSettled handlers as the last argument. In most cases, it is most useful to pass a rollback function.
To do this, useMutation's onMutate handler option allows you to return a value that will later be passed to both onError and onSettled handlers as the last argument. In most cases, it is most useful to pass a rollback function.
...
No description
metropolitan-bronze
metropolitan-bronze9/20/2025

When to use a utility and when to use a custom hook with select?

I want to know what the best practice is for filtering data. I have a main hook that reaches an endpoint. And every time I need to process specific data, I create a new hook and use the main one, passing it a utility as a parameter. The problem is that the hooks are piling up... And I often end up using them in only one place in my application. Therefore, I'm not sure when I should create a new hook to handle data filtering and when I should use the base hook and pass it a utility to filter from...
No description
metropolitan-bronze
metropolitan-bronze9/20/2025

Best way to handle errors with multiple components sharing queries

I have encountered a use case and would like to know the best practice for handling it. I have three components that use the same hook, retrieving “requests.” In case of failure, I want to display an ErrorRequest.tsx component, which may be the same or different in each component, that doesn't matter. The problem is that if I check the “isError” state in each component, I will end up displaying the ErrorRequest.tsx component three times when there is an error, which would be strange for the user. Also, if I want to pass the refetch function, the buttons in ErrorRequest.tsx will not be synchronized because they do not share state. I discussed this with Claude, and he said that the only solution would be for a single component to request isError and return ErrorRequest.tsx, and for the other two to return an empty fragment. But I don't think that solution is scalable. Another option would be an ErrorBoundary, but I have other components that use other hooks on the page, and it would be bad for the user if, because one endpoint has an error, they couldn't see other components that don't have it....
No description
itchy-amethyst
itchy-amethyst9/19/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....
stormy-gold
stormy-gold9/18/2025

Better-Auth Integration

I have successfully refactored the better-auth nextjs demo to tanstack start https://github.com/better-auth/better-auth/tree/canary/demo/nextjs But I have a question: ...
absent-sapphire
absent-sapphire9/17/2025

invalidateQueries not invalidating

I'm using tanstack router with useSuspenseQuery (wrapInSuspense: true). I have two APIs: one is a list of users and the other is the user details. You can favorite a user on the list page. You can click on their username to take them to the details page. You can view and favorite the user on the details page. On the list page I can see user1 is favorited. I click on user1 and it takes them to view user1 details. I see that they are favorited here too. I go back to the list page and unfavorite. I see they are unfavorited there. I go back to the user page and see they haven't been unfavorited. I call invalidateQueries on both inside the mutator. Toggling the favorite on either page will invalidate the currently rendered view correctly, but it's as if the other view isn't being marked as stale....
stormy-gold
stormy-gold9/14/2025

useSuspenseQuery + TansTack Start with better-auth

I have successfully refactored the better-auth nextjs demo to tanstack start https://github.com/better-auth/better-auth/tree/canary/demo/nextjs But I have a question: ...
extended-salmon
extended-salmon9/14/2025

New to Tanstack Query, Help me understand ,

new to tansatck query i have a inventory management /payment / transaction settlement application on react + spring boot as in this there are lots of tables , using tanstack table for them and fetching data , all api calls done with axios JWT token , have been intructed not to use cookies , currently stored in localstorage , havent used any state management libs too like redux zustand ,...
useful-bronze
useful-bronze9/13/2025

Disabling `useSuspenseQuery` on the server with TanStack Start

Hey! I'm using TanStack Start + Query together, using suspense everywhere, and have a long-running query that I don't want running in SSR. I'd rather it just run on the client. I originally thought I could just disable the query, but found enabled is not a supported property with useSuspenseQuery. ...
genetic-orange
genetic-orange9/11/2025

Preserving search results with useInfiniteQuery

I have an infinite endpoint which is hooked up to a form, the user can search for and select user “Steve” who is not on page 1 (without search). The onSearch clears in my select component, and this makes the react query trigger with an empty search value, it refetches page 1, and then removes the “Steve” option. How can I preserve that option? It works fine for normal scrolling, but not with search. ...
itchy-amethyst
itchy-amethyst9/11/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....
rare-sapphire
rare-sapphire9/8/2025

invalidateQueries not triggering refetch consistently across projects

Hello, I’m running into an issue with invalidateQueries. I’m using the same setup in two different projects, and in one project it works as expected, while in the other it doesn’t trigger a refetch after invalidation. Here’s my setup:...
Next