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

fascinating-indigo
fascinating-indigo11/1/2022

optimistic *delete* with infinite query

What should I do if I want to implement optimistic delete? For example: - My page size is 10. In getNextPageParam, if the length of lastPage is less than 10, then return undefined to indicate that there's no more data. - The first page is loaded - I delete one item, setQueryData with 9 remaining items...
fascinating-indigo
fascinating-indigo11/1/2022

Notifications and live updates - are websockets the best way to do it?

I am adding notifications and live updates to my react app. I currently use react query for server state management on the frontend and mongo + mongo app services (realm) for the backend. Have setup an api that the client can subscribe to and thinking of following what TkDodo has mentioned in his blog post https://tkdodo.eu/blog/using-web-sockets-with-react-query. Is this the best way to do it or would you recommend something else?
deep-jade
deep-jade10/31/2022

how to force isLoading state for debugging?

πŸ‘‹ I have a typical component written like that: ```ts const { isLoading } = useQuery(...);...
zesty-coffee
zesty-coffee10/30/2022

useQuery reactivity question

I am trying to understand what to expect when I pass the queryKey as an argument. When the value of the array or function I pass changes should I expect useQuery to recalculate the queryKey? does the same go for the other arguments?
rising-crimson
rising-crimson10/30/2022

UseQuery with moralis api

Hi everyone, I'm trying to fetch some data with moralis in my next.js app, using useQuery, and I can't achieve this πŸ˜• Maybe because I'm using a hook in an async function I don't know, but the moralis.start() really bother me here :/...
national-gold
national-gold10/30/2022

actual ssr next behaviour

Hey! Newbie nextjs cache question. Does the server cache actually store the data when you navigate between routes? Eg. If i fetch ’allPosts’ on page A via getServerSideProps with the hydration/dehydration client. I then navigate to page B and want to load this data on the server side for page B, does it use the cache from page A if i try to hydrate via getServerSideProps again, or is it gonna make a other request to fetch this data again? Struggle to understand the exact logic for this πŸ˜…...
correct-apricot
correct-apricot10/30/2022

Controlling how UI updates with refetched data

Hello! The default experience when using react-query is that stale data is shown while the given resource is refetched, then if the resolved data is different, it automatically gets updated in the UI, typically just sorta "popping" in, if you understand what I mean. This is due to how we tend to directly use the data returned from useQuery, something like (warning: pseudocode ahead):...
deep-jade
deep-jade10/30/2022

Is there a property to check if React Query is currently fetching something?

hey is there a property for something like "is there is anything fetching right now?", I mean something like isLoading but not specific to any single query, but to all queries. basically "is react-query doing something right now?" I need this to show a spinner while all of the queries are fetching, and when they're all done then show the page's content. To do this, I need something to be able to tell if React Query has finished all of its fetching....
like-gold
like-gold10/30/2022

Getting weird response from react-query-firebase

Hello, I am using react-query-firebase set up like below: `import { QueryClient, QueryClientProvider} from "react-query"; const queryClient = new QueryClient();...
optimistic-gold
optimistic-gold10/27/2022

Making the data value changeable

Hello, I have a question about making the data I get back changeable, namely what happens is that I have a useQuery that gives me back an id from the server, but in my queryFn the id is a query parameter, which is supposed to be changed whenever I select a different user in the UI through a Dropdown component. ```js const { isLoading: isLoadingUsers, data: users } = useQuery( ["users"], () => getUsers(),...
genetic-orange
genetic-orange10/27/2022

Error No QueryClient set error on useMutation Custom Hook

I have a QueryClientProvider wrapping the whole application at the root and parts of the app that use custom useQuery hooks are working fine. When I go to a page in the app that a custom useMutation hook the page does not render and I get this error in the console log. Not sure what I can do to get around this error. any suggestions?...
ambitious-aqua
ambitious-aqua10/27/2022

tanstack match-sorter-utils. Module parse failed Unexpected token

Hello, I have installed reactQueryDevtools and now when I'm trying start storybook it says: ERR! ./node_modules/@tanstack/match-sorter-utils/build/umd/index.production.js 18:1274 ERR! Module parse failed: Unexpected token (18:1274) ERR! You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. Does anyone had this issue?...
No description
conscious-sapphire
conscious-sapphire10/27/2022

How can i handle server driven pagination

i have a backend that responds with data AND pagination. Should I keep the paginated data in local state , even though it is managed from react query as well? im a little confused on this...
afraid-scarlet
afraid-scarlet10/27/2022

Is there any way to get the response headers?

Is there any way to get response headers after a successful post useQuery?
afraid-scarlet
afraid-scarlet10/26/2022

Query key returning data from a different hashed query key

I have a query key that looks like this ``` Key #1 [...
adverse-sapphire
adverse-sapphire10/26/2022

React Query with Next 13

Hi, is there any guide to implement RQ with Next 13? Thanks
rival-black
rival-black10/26/2022

handling timestamps

Hey, we have lots of data on the backend which we segregate by time stamp and fetch in a range with a picker on the UI. How would you utilise react query here? As the user changes time stamp range try to do a custom merge of the data and store by key?
equal-aqua
equal-aqua10/26/2022

How to approach the need for instant state?

I wanted to get people's opinions on how to manage the below situation. At the moment we use redux to fetch a global user object and use some data in our headers. Obviously, a straight replacement of redux to RQ won't work in this instance as the data is undefined initially. I can manage most uses of undefined in the UI with redirects etc but this is bit different. current implementation:...
other-emerald
other-emerald10/26/2022

Testing optimistic update in react query.

I am trying to write test case for optimistic update mutation. But it's not workin for some reason. Can anyone please have a look here. I am providing the stack overflow link. https://stackoverflow.com/questions/74209718/testing-optimistic-update-in-react-query
fair-rose
fair-rose10/26/2022

If staleTime set my data isn't refetched even the queryKey array changes.

When offset state is changed my query isn't refetched ``` const { data, status } = useQuery<PaginatedData<never>>( [url, offset],...