Skip to main content

Questions tagged [react-query]

React Query is hooks-based library for integrating data fetching into React function components

react-query
0 votes
0 answers
17 views

React Query wont invalidate and re-fetch at the initial mutation call. but if I defocus my browser window and focus again, it starts working correctly

I have a react query problem. the very first edit I submit does not invalidate the data. but if I defocus and refocus the browser window it starts invalidating correctly after each mutation without ...
Arian's user avatar
  • 1
0 votes
0 answers
17 views

Getting an empty object in data for updates

Im working on updating a document in my mongodb, the document has a field, which is an object that has other fields attached to it, I have 1 field i want to update, the others should stay the same, ...
Austin Howard's user avatar
0 votes
0 answers
35 views

How to use react query data in another component without moving state up?

I am using nextjs + typescript + react-query. Currently my app has an input that asks a user for a url, which is then used to fetch a list of github issues. Here are the simplified versions of the ...
joebob's user avatar
  • 33
0 votes
0 answers
9 views

TypeScript Type Error When Transforming API Response Format to Different Format Using Select in useInfiniteQuery

Custom Hook Call const { data } = useListInfiniteQuery({ searchText: SearchText, dateRange: dateRange, select: getListItems, }); Select Function function getListItems({ pageParams, pages, }:...
Arpitha's user avatar
0 votes
0 answers
21 views

getServerSideProps with ReactQuery doesn't cache properly

im using nextjs 14.2.3 (page router) with react query, and my data is not cached when im trying to call an api on the server with getServerSideProps with reactQuery. when ever i change my route, the ...
shahin behzadrad's user avatar
0 votes
0 answers
36 views

React query not updating data even after refetch shows new data from api

I am using react query to fetch a list of items. After creating a new item, I am calling refetch on my query to get the updated list. I see a new api call is made, and the new item I just created is ...
Seth Lutske's user avatar
  • 10.3k
-1 votes
2 answers
44 views

Is React Query more efficient compared to using hooks?

Is React Query more efficient compared to using useEffect and useState, given that these hooks are built-in and easy to use? If so, why choose React Query? Why is React Query more efficient than hooks ...
Abhishek Tyagi's user avatar
1 vote
1 answer
56 views

Querying data with React Query and React Table causes page crash

I'm developing an app with React Query and React Table but table seems to break when I change the query key, thus causing the website to crash. I opened an issue on their GH but I still have no ...
Herbie Vine's user avatar
  • 1,955
0 votes
0 answers
42 views

Tanstack react query. isLoading is always true for dependent query on subsequent requests

I am using react-query. I have a mutation and 2 queries where the second query depends on the data from the first query. This means that if I invalidate the first query, the second query is also ...
Andrey Rafalskyi's user avatar
0 votes
0 answers
36 views

React query prefetchQuery with Suspense

I'm working on my Next.js project with a server component page where I'm prefetching posts with HydrationBoundary. Here’s the server component: 'use server'; import PostList from '@/components/shared/...
O_zeilo's user avatar
0 votes
0 answers
23 views

React Query, how to keep data cached until a valid response comes again

I'm having an issue where my app is removing OK responses from the cache and returning 404 if the backend is down. Currently, cache and revalidate time are the same. I need to cache these requests ...
JorgeeFG's user avatar
  • 5,843
0 votes
1 answer
59 views

React Query - Use response from list fetch to `setQueryData` for each item?

I am fetching a list of items to render in a listing page - let's call them Todos. The fetch is done via a custom react-query hook that caches the response under the ['todo-list'] queryKey. When I ...
Jester2007's user avatar
0 votes
0 answers
38 views

React Query useMutation is getting called so many times

I have a react component that has an useEffect like this: // MQTT client const client = mqtt.connect(brokerUrl, { clientId, clean: true, username: import.meta.env....
hathai's user avatar
  • 75
0 votes
1 answer
60 views

How to not fetch cached data in react-query?

I have a query that fetches some data in a date range, I recently moved from doing it myself to using react-query and am stuck on the cache logic. What I want is if this date range was fetched once, ...
GeorgeSedhom's user avatar
0 votes
0 answers
46 views

Unexpected Application Error! this[#client].defaultMutationOptions is not a function

UPDATE: Solved the issue. It was a problem with the version of @tanstack/react-query. I used the v5 and had this problem and did a downgrade to v4. Now it works fine! I'm always getting this error ...
daniel235's user avatar

15 30 50 per page
1
2 3 4 5
121