All Questions
Tagged with react-query tanstack
28
questions
1
vote
1
answer
70
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 ...
-1
votes
1
answer
119
views
React Query useQuery can't trigger repeat call on click
I have a table of info where each row has a button to trigger a useQuery that will eventually open a new tab where more info about that row can be seen.
I can trigger the call to work as expected the ...
1
vote
0
answers
59
views
TypeError in Tanstack Query React
I am new to react tanstack query and I am building a todo list app to reinforce the concepts that I am learning. The todos are coming from DummyJson API -https://dummyjson.com/docs/todos. The response ...
1
vote
2
answers
642
views
Tanstack React Query useMutation always True in onSuccess
import { TNewServicesProps } from '@/_constants/types';
import api from '@/_libs/api';
import { useMutation, useQueryClient } from '@tanstack/react-query';
const useManageServices = (
method: '...
0
votes
0
answers
113
views
Using react query differently in online and offline mode
I'm using react query in my react native app with the following configuration : Stale Time = 3 minutes Cache Time = 5 minutes But the problem is that i need to get data from cache if there is no ...
1
vote
0
answers
412
views
Pattern for ErrorBoundary + TanStack's useQuery
Installed dependencies
@tanstack/react-query: "^4.29.5"
react-error-boundary: "^4.0.13"
I can't seem to get Error boundaries working. I've stripped down my components to be the ...
0
votes
0
answers
28
views
invalidateQueries request is triggered and responded with fresh data but cache is old
I use
"react-query": "3.34.19",
here is example of data structure
{
"column_id": "10_plus_years",
"label": "10+ years",
&...
3
votes
1
answer
2k
views
Getting 'isLoading' state undefined in react query
After I updated react query to the latest version, I am getting undefined for 'isLoading' state when using useMutation. Here is the code:
const useAddUserNote = (owner: string) => {
const ...
-1
votes
1
answer
1k
views
tanstack-query won't fetch proper data when key changes
whenever i change the sorting to something else, the query key changes but no refetch is done. So its always the initial data being shown despite changes to query key.
"use client";
import { ...
0
votes
0
answers
25
views
Products are not added to the general product list when using the React Query cash
I need to add a new product to a list using a React Query cash. The new entity does not come from the server, so I use setQueryData to manually update it from what comes from the mutating function. ...
-1
votes
1
answer
133
views
Why do I have to do a return here?
I wrote a function to fetch a user. And I return the user.
But when I call the function with TanstackQuery the data is undefinded.
When I add a return statement in the useQuery() function it works.
...
0
votes
0
answers
254
views
React Query performance issue
I am using React Query in my React app, when I using enabled option to tell a query when it is ready to run, it is still persists to the cache as disabled even if this query not execute. I wonder if ...
0
votes
1
answer
527
views
Nested/conditional chained API calls in React Query?
We need a function that may call an API or the other, and based on the result, call yet another API.
Let me give a simplified example. We're trying to do something like this
function getCarDetails(car:...
2
votes
1
answer
3k
views
Fetch on mount and disable query in React-query
There is a search result page where query params are passed to useQuery. On this page, we can change our search prompt (query param essentially) however I only want to refetch when user click "...
1
vote
1
answer
985
views
How to invalidate cache initialData in react query/tanstack query?
I am using useQuery hook in TanStack Query (previously React Query) to cache data, in my case I config initialData depend on another hook useInfiniteQuery but when I am trying to invalidate ...