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

passive-yellow
passive-yellow4/4/2024

vue-query query return types are not unwraped in template?

Hello! New to vue-query so unsure if this is a user error but the return type of ```ts...
No description
plain-purple
plain-purple4/4/2024

Enable/Disable QueryDevtools on custom env?

Is there a way to use a custom environment variable (other than NODE_ENV) to based on a different variable? Basically I want to show it on a dev server, but not run the dev server in development mode.
quickest-silver
quickest-silver4/4/2024

useInfiniteQuery always refetches when search state changes even if all data has already been fetche

I would like that when a user types in the search bar, we fetch all the results so they are always getting an exhaustive search. So I am passing the columFilters state to the queryKey array. However even if all the results have already been fetched an entire refetch is done when the search key changes. This is not ideal. Can anyone help with a workaround maybe how to prevent refetch when all data has been fetched or better approach? ...
No description
like-gold
like-gold4/3/2024

Error handling

Hi guys! I want to throw for second call when http response code is 500 const {data, isLoading, refetch, fetchNextPage} = useGetDeckSuspenseInfiniteQuery()...
No description
like-gold
like-gold4/3/2024

Best Practices for Using tanstack-react-query with GraphQL in a Monorepo Structure

Hey 👋🏽 , I am using tanstack-react-query in a monorepo. I have a package called shared-features. This package contains features, which uses react-query. I'm using GraphQL, so I can't just use a defaultQueryFn. I need a way to inject a query-fn. Here's my current setup at the main-app, which should consume the shared-features-package. ```js...
automatic-azure
automatic-azure4/2/2024

`useInfiniteQuery` stalls at 'pending' status in NextJS App

Hi everyone, I've been trying to get a custom hook to work for a while now. The hooks is just a wrapper around useInfiniteQuery which helps me get some data which I want to render out on the screen. Here's what I'm currently trying: ```typescript export const useGetLodgesInfinite = (payload?: LodgeService.GetLodgesPayload) => {...
No description
helpful-purple
helpful-purple3/31/2024

When my useQuery is in error state, it seems to auto refetch.

Is this an accurate assumption? What is the interval time at which it refetches? How can this be controlled?
silky-coral
silky-coral3/30/2024

data not getting updated immediately

hey everyone! im using react query to fetch data. But when i update some data on backend(supabase) then the updated data is only seen once i refresh the app. invalidatequeries not working and in log also the updated data coes after refreshing cananyone help on this...
conscious-sapphire
conscious-sapphire3/30/2024

useForm defaultvalues

So useFrom provides a way to populate the form with default values the problem is that when we use usequery it does not returns a promise so we cant really await that and i tried to wrap in new promise constructor that does not work either.. so how can i await the react query inside a function so when the data is available i will be able to populate the form https://www.react-hook-form.com/api/useform/#defaultValues...
adverse-sapphire
adverse-sapphire3/29/2024

What data strategy should I use?

I have another situation, similar to my last post, but in a different application. The application has more than one List screen, each with it's own paginated list of Item's. The Item in question is the same for each screen, but each screen is querying our backend with different filters. There is also one Details screen that takes in an ID for an Item and displays it. This is my current data strategy:...
robust-apricot
robust-apricot3/28/2024

Is it possible to call a mutation inside of a Next.js server component?

I want to mutate data on our GraphQL backend but the component I'm in is a server component inside of a server component and I can't change it to a client component because you can't have client stuff inside server stuff. Is it possible to run a mutation inside of a server component? For queries, I use queryClient.fetchQuery but there doesn't appear to be a similar method on queryClient....
absent-sapphire
absent-sapphire3/28/2024

Refetch mutation after user action.

Hi ! I have a useMutation to get datas and display it on a Table. I would like to refetch my datas without havin to refresh de page. but i don't understand how can i use my queryClient to trigger the refetch....
rare-sapphire
rare-sapphire3/28/2024

Is there a way to persist data like `useInfiniteQuery` does, but for parallel queries?

I send few parallel requests to get info about n days, but if number of results is not enough I'd like to make another fetch (for another n days), and persist data from previous fetch. Is that possible somehow?
evident-indigo
evident-indigo3/28/2024

data from useInfiniteQuery hook returning undefined despite the API correct returning it

The data property from the useInfiniteQuery is returning as undefined even with the response returning the correcta data. Does anyone know the reason?
correct-apricot
correct-apricot3/27/2024

im using react query 3. how can i get the data for a set of queries or the is loaded/successful

im using react query 3. how can i get the data for a set of queries or the is loaded/successful .. but i need to match just the begining of the key because the rest of it is dynamic.
manual-pink
manual-pink3/27/2024

Knowing the current page of `useInfiniteQuery`

We're implementing a text search interface that lists up to 10 results from a starting timestamp and query, so we can bi-directionally search. Is there a good way of knowing what our current page is? I've skimmed the docs and probably missed something but the only thing that comes to mind is a local state variable.
firm-tan
firm-tan3/27/2024

Implementing Data Polling with Stale Data in Next.js 14 using React Query

Hey everyone! 👋 Let's delve into a scenario: In the app I'm developing, there's a flight details page designed to display real-time flight information. The challenge is that this data needs to be updated every few seconds....
No description
like-gold
like-gold3/26/2024

queryKey works as string but not with number

Hi guys! I've a query key: detail: (id: number) => ['decks', 'item', id], When I make an edit mutation I got a result from the server, where id is number. So i use setQueryData with it....
sensitive-blue
sensitive-blue3/26/2024

Failing to integrate react-query devtool triggers with tanstack-router

Hi friends : D I posted this question first on the tanstack-router question board and it was suggested I might have more luck here I would like to be able to trigger the rendering of the errorComponents and pendingComponents by clicking on the corresponding triggers in the react-query dev tools but I'm getting mixed results. ...
harsh-harlequin
harsh-harlequin3/25/2024

Avoid firing useQuery on every render

Hi! So I have a useQuery for getting a list of items and let's say this list is then put into a checklist. Now my problems is, every time I change a checkbox state, the page rerenders and it fires the useQuery again. How would I go about limiting the useQuery here? Thank you! Note: Not sure if makes a difference, but I'm using Tanstack Table and the checkbox is to select the row....