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
Non-undefined placeholderData types as possibly undefined
placeholderData
function always returns a proper result (not undefined), then why is the resulting data
property typed as T | undefined
?
Consider the following example:
```typescript...How to use the startTransition from react?
I'm having an issue with an uncaught promise on a mutation
``TypeScript
const mutationAddQuestion = useMutation({
mutationFn: async (formData: FormData) => {
const correctAnswer = Array.from({ length: numberOfAnswers }).findIndex((_, index) => (formData.get(
correctAnswer${index}`) === 'on')) + 1;...Drawbacks of multiple related mutations in one hook?
Is it possible to have mutation queue that will run until the queue empty ?
Should queryFn(fetcher) be independent of React life cycle?
How to handle when query depends on a non string/JSON serializable object reference?
What are some common practices regarding queryOption abstractions?
US partner wanted for a profitable venture
MutateAsync error handling (callback vs. try/catch/finally)
useSuspenseQuery when offline
experimental_createPersister
so the network mode is set to offlineFirst
. Whenever I render this when offline, and no data is persisted yet, the suspense fallback (LoadingComponent
) keeps showing. Instead I want a placeholder to tell the user they are offline and they should retry when online.
```ts
<QueryErrorResetBoundary>...`keepPreviousData` with `useSuspenseQuery` with nextjs streaming ssr
useSuspenseQuery
with ReactQueryStreamedHydration
from @tanstack/react-query-next-experimental
This works great
However my query has a regular changing query key, but I want to show the previous data during loading states
So I switched useSuspenseQuery
to useQuery
with placeholderData: keepPreviousData
, this also worked great however it lost all of the server streaming behavior...queryOptions counterpart for useMutation?
queryOptions
as mentioned in this section of the documentation:
https://tanstack.com/query/v5/docs/framework/react/guides/query-options
I was wondering if there was a counterpart for this for useMutation
....Query returning old data after mutation when manually setting data using setQueryData
How to mock loading/error states.
Vue Query 401 Unauthorized response
How can I pass an authorization header to all queries and mutations
UI gets stuck after updating React to React 18
Is there a way to either go back to initial state or set data directly?
How do I tell useQuery that initial data is prefetched on the server?
MyData | undefined
because useQuery doesn't know the initial data will be there. How do I solve that? For now I solved it by setting initialData: {} as MyData
in useQuery but I wonder if there is a better way?