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
in useMutation, how to get error status code inside onError?
Query reloads
I want to mutate every time the user interacts with the form. useQuery & useMutation cause rerenders
Avoid refetch on initial load
selectedNode
is persisted on the server and because the resources are slow/expensive, we load both asynchronously. However doing this means the grid is aborted/refetched (or refetched if the grid finishes first) when selectedNode
gets set so we're wondering if there's a good way to avoid triggering a refetch for that first load?
```tsx
const selectedNodeId = selectedNode?.id
...Accessing react query without hooks
Bi-direction infinite scroll table with maxPages - uncontrolled scroll
maxPages
to control the cache size, I encounter an issue with scrolling. On scrolling up/down, sometimes the table continues to scroll well beyond how much I actually scrolled on my mouse wheel. It's as though the browser takes over and decides it's going to keep on scrolling until it hits the end of the table. If I don't set a maxPages
argument though, the scroll behavior is as I expect. That is, the table scrolls based on how far I scroll, and doesn't get caught in a continuous scroll.
Reprex I have a code sandbox that illustrates the problem. Commenting/uncommenting maxPages
(no other changes) results in the two different scroll behaviors....Colocation of queries and qpi calls related to components.
index.ts
and queries.ts
each with the 20 - 30 respective api calls / react-queries. I am trying to optimize a bit, reducing api code, but also restructing the app to make it a little less cumbersome and more readable. Looking for info on where to place the queries and associated api calls, instead of one huge file. Would you break them up and keep them inside of an api folder still, or go a step further and put them under the component's folder, ie.
```
/TopApplicationBar
|-TopApplicationBar.tsx
|-TopApplicationBar.module.css...onSettled throws annot update a component (`HotReload`) while rendering a different component
"next": "14.0.4"
"@tanstack/react-query": "^5.17.12"
I have server component that is prefetching data and storing in cache. Then i have mutation that is updating the state which is OK until i add this line of code:...filtering, sorting and pagination
Can we change staleTime and cacheTime via props or state change after query is mounted?
Since v5 deprecated onSucces and onError callbacks is okay to implement a custom hook like this ?
I have a problem with authentication using React Query.
React Query not respecting initialData when there is cache

Safely setting store state based on query data/status
Same queryFn for multiple useQuery calls?
useQuery
, if most of my get calls are all basically the same but just call a different backend route, getUsers, getCustomers, getCategories
etc., can I just use the same generic function?Understanding frequent network calls
useInfiniteQuery
to get all of the tasks. When you click on an individual task, the search params are updated to hold the id
for the selected task and a modal appears that makes a call to a useQuery
to get the data for it to display. Is it expected that opening this task modal would also trigger a network call for our /tasks
endpoint that is called with our useInfiniteQuery
for the whole task board, even though nothing about the board has been modified?...Component not re-rendering on removeQueries()
FlatList
with items. Lets call them FlatListItem
.
I am using memo
to memoize my Items to prevent them to re-render when the parent changes using export default memo(FlatListItem);
For each FlatListItem
in my list I have to fetch data. In a separate file I define a hook and a query function. Simplified they are looking like this:...Best practice for dealing with mutation function that doesn't error
Why do PATCH and DELETE requests not refetch the data from the database?