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
Is it expected that queries with a `gcTime` set aren't used by `react-query-persist-client?
Is there a way to manually set the entire cache to a new value?
queryKey to setQueryData(). I've written a recursive function that gets the entire cache and updates every occurance of the value and returns a new array. How can I set the cache to this new array?
(If there is a better way of doing what I'm doing I'm open to suggestions)
Thanks...Querying an API for a Details screen without a "details" endpoint
useQuery hook and call the API's list endpoint and populate the screen with an entry for each Foo. Each entry is clickable, and clicking will open the Details screen (passing in a unique Foo ID). However, that is where the data stops.
The Details screen has no way direct way to get the Details of a Foo, as there is no API endpoint for it. The best option I see is to use useQuery again, and hope it hits the cache from the List screen (the list endpoint includes all the details), instead of sending out a new request. That still feels like bad data practice, though. A second option would be to use QueryClient.setQueryData to set each individual cache for each Foo, but I feel like that may also be frowned upon from a "best practices" perspective (setting the query data outside the normal way, fetching).
What should I do in this scenario?...Using custom hooks in loader function
What is the recommended way to trigger a GET just once on button press?
React - queryClient.getQueryData(key) - can I think about it as about useContext?
<ParentComponent /> using useQuery hook. I have a lot of nested children in this component and I need to display the data on the bottom of the tree and I consider following options:
- props drilling - sounds bad as usual props drilling 🙂
- context - there are performance issues with the context without using useContextSelector and it's not compliant for some reason.
- queryClient.getQueryData as a mechanism to retrieve in the bottom of the tree or throw when undefined.
...Modifying the type of mutateAsync's
mutateAsync with partial data for that entry. However, the type for the variables of the mutateAsync function seem to be the same as each element in my useQuery result, and this gives me a type error, because I'm leaving out a bunch of fields that the database will eventually default to.
Specifically, I have this:
```ts...Project structure
useInfiniteQuery Hook
fetchNextPage working via the getNextPageParam method. I do not know how to go about the fetchPreviousPage working, i've tweaked with the getPreviousPageParam method but it doesn't still work. I'll appreciate if anyone can point out how i can fix this. Attached below is the query function:
`const {
data,
fetchNextPage,...Vue Query potential issue?
use...() in two components).
In both components it has staleTime of 60 minutes.
When I'm loading app in Cypress tests, sometimes it fails (80% of the time).
The difference between pass and fail is that when test fails - query is called only once (as expected). And test passes when query is called twice (but only one request is actually made)....React Query with apisauce
How i can use QueryClient in server and client component?
QueryClient from a separate file and import it in my components?...Angular Query
Error Handling Mechanism
invalidate all queries with specifix prefix
`invalidateQueries` only triggers re-fetch once after reload but not afterwards
invalidateQueries onSuccess and the dialog will be closed.
For the first time after reloading this also re-fetches the query connected to the table after invalidation. After that, when I edit data again, nothing happens. How can that be and how to fix it?
UPDATE: The source problem (I think) is that I set the queryClient within the function body because showNotification is used with is returned from a custom hook. I would like to keep this solution but do not know how...MongoDB's Keyset Pagination technique
`setQueryData` slow to update
setQueryData to opmistically persist reordered elements, but looks like there is some kind of delay to state update and I can notice a flash of items getting back to old positions before the new order is persisted.
Is there something I can do without need to use a local useState?...setQueryData with infinite query
Mutation optimistic updated slows down the UI