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

plain-purple
plain-purple6/13/2024

executing enabled false query

``` export function getAssistantOptions(id: string | null) { return queryOptions({ queryKey: ['assistant', id], queryFn: () => console.log('log'),...
magic-amber
magic-amber6/12/2024

How to use useQueries

Is this the correct way to combine two get requests with useQueries? ```jsx export const useDashboardData = (setupId, days) => { return useQueries({...
probable-pink
probable-pink6/11/2024

Tanstack Query pageParam typescript, readonly

This is my code: ``` const { data, isLoading, fetchNextPage, hasNextPage, isFetchingNextPage } = useInfiniteQuery< PropiedadesResponse,...
flat-fuchsia
flat-fuchsia6/11/2024

setQueryData + refetch vs fetchQuery

I'm reviewing a PR that has setQueryData + refetch (page uses useInfiniteQuery) ``` queryClient.setQueryData(queryKey, (data: any) => ({ ...data,...
xenial-black
xenial-black6/10/2024

container shrinking when loading

I load a different api when some state changes.when i change state and api starts loading,my container becomes empty and shrinks in a way it has no data then immediately gets new data. It is a disgusting design for the user's eyes so how can i prevent it?(I want to show something like a spinner but that spinner isnt guaranteed to be the same height as the previous data of the container)...
metropolitan-bronze
metropolitan-bronze6/10/2024

Calling server action using useQuery?

```tsx 'use client'; import { useQuery } from '@tanstack/react-query'; export const runtime = 'edge';...
helpful-purple
helpful-purple6/10/2024

Select portion of useQuery only runs on first page load

I am building a table of Quotes where I get the quotes using useQuery andI have a filter up top. So what I have done is use the select property to build two state arrays, all and filtered. That looks like this: ```js const { data: priceLists, isLoading: gettingPriceLists,...
grumpy-cyan
grumpy-cyan6/10/2024

Devtools CapacitorJS

Hey guys, I'm I'm implementing react-query in my CapacitorJS app, and I'm developping on an iPhone emulator. Wanted to know if the default devtools should works or if I need to use the react-native devtools ? Thanks!...
other-emerald
other-emerald6/10/2024

how to update the querry data if any mutation occurred

I have fetch all post from backend with react query. Mapping over the data array which react query provide i have render all post. Now lets say I have LIKE button on each post , if a user like any post how should I update the data state? I don’t want to refetch again. What could be the good of doing this. Does invalidating the query make fetch again?...
fair-rose
fair-rose6/9/2024

Can I get notified that all useQuery hooks for a query key have unmounted?

Or can I set gcTime to 0 and get notified of that? I'm using fetch functions that start subscribing to data on a WebSocket and I'd like to know when to unsubscribe....
absent-sapphire
absent-sapphire6/8/2024

queryClient.prefetchQuery not prefeching on the server (Next App Router)

I beleive i did everything correctly form tanstack documentation
No description
deep-jade
deep-jade6/8/2024

Query not working correctly until changing query key to a new, clean one

Hi everyone. My query doesn't fetch data server side after I changed the query key forward and then back. The part that confuses me is that I don't use any external storage plugins, but the issue resolves if I change the key to a new, clean value. Restarting the app doesn't help. How does React Query preserve cache between app starts?
fair-rose
fair-rose6/8/2024

useMutation not functioning

I have React and React-dom updated to version 18 and I am getting this error from Tanstack's useMutation function Uncaught TypeError: React10.useSyncExternalStore is not a function Has anyone ran into this issue before or have any insight on what I should be doing or looking for?
other-emerald
other-emerald6/8/2024

how to access react query fetched data in all component

I have fetched data in my home component but I want to access the same data in my nested component, is it possible to access the data globally without passing as props.
solid-orange
solid-orange6/8/2024

The background of the birth of the Tanstack Query and the current concerns or future.

Hello. My name is Aaron Kim. While using Tanstack Query, I felt that it was a very convenient and useful tool. I gave you a mention because I wanted to ask you a simple question about preparing for the technical seminar on Tanstack Query at my company. Of course, I can collect and organize information through Googling, but I actually wanted to hear Co-Maintainer's opinions in person. I know you are busy, but I would appreciate it if you could respond. @TkDodo 🔮 1. I'm curious about the background where Tanstack Query technology was born. ...
conscious-sapphire
conscious-sapphire6/7/2024

How to setup automatic invalidation after mutation

I want to setup a remix like automatic invalidation. I saw this post from TkDodo: https://tkdodo.eu/blog/automatic-query-invalidation-after-mutations#the-global-cache-callbacks But I am having trouble understanding how is solution is possible. ```tsx...
fascinating-indigo
fascinating-indigo6/6/2024

useQuery options changed per hook invocation

Hi there, I'm adoptiong react-query throughout my app and have a breif question regarding the architecture: Say I have a custom hook that wraps useQuery, and accepts one argument to override a useQuery option: ``` function useCustomQuery(refetchInterval: number) {...
magic-amber
magic-amber6/6/2024

How to Combine and Handle Multiple Mutations with Shared Success and Error Handling in React Query?

I have two mutations (2 fetch put request) in the same react component, i have modals i show for both on success and onerror, how can i combine those two mutations since i dont want to show one modal for each mutation.
adverse-sapphire
adverse-sapphire6/6/2024

setQueryData with marked data to no refetch data in specific time

- I have the same endpoint using by useMutation and useQuery - first app start I call useMutation and there is any data I would navigate to the screen then in the screen also have useQuery using the same endpoint as useMutation - I want to use setQueryData in useMutation onSuccess with marked query to not refetch when I navigate to the screen that using useQuery - is is possble to call setQueryData and marked the query as refetched ? - WHY I using like this ? -> I migrate from redux to useQuery but some how I want to save requesting to my...