Repository navigation
React Query v5 beta - #1705
Merged
Merged
React Query v5 beta#1705
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
david-crespo
commented
Jul 27, 2023
| } from '@tanstack/react-query' | ||
| import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query' | ||
| // TODO: either do this differently or get them to export this type | ||
| import type { UndefinedInitialDataOptions } from 'node_modules/@tanstack/react-query/build/modern/queryOptions' |
Collaborator
Author
There was a problem hiding this comment.
working on this, otherwise I think we're ok
Collaborator
Author
There was a problem hiding this comment.
We'll see if they accept adding the export or give me a tip about a different way to do it: TanStack/query#5794
david-crespo
commented
Jul 27, 2023
|
|
||
| /** Result that includes both success and error so it can be cached by RQ */ | ||
| type ErrorsAllowed<T, E> = { type: 'success'; data: T } | { type: 'error'; data: E } | ||
|
|
Collaborator
Author
There was a problem hiding this comment.
All of this continues to work and I understand it because I wrote it, but it's ridiculous. I'm always mulling over how we might avoid a lot of the complication here by generating more code in oxide.ts instead.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The beta looks very solid — they've been doing alphas for a very long time. There aren't major direct feature improvements that we need over v4, but there are big internal simplifications that reduce the surface area for bugs. There are also improvements to the types due to the single signature for
useQuery(see tweet from maintainer). I also want to get on v5 before making any big changes to our data fetching while working on #1703.The key changes for us are:
useQueryand friends take{ queryKey: ..., queryFn: ... }as part of the options object instead of taking the key and function as positional args (docs)isLoadingbecomesisPending(docs)keepPreviousData: truebecomesplaceholderData: (x) => x(docs)useErrorBoundarybecomesthrowOnError(docs)https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5
Marking as draft because I still want to do some cleanup. There are some ridiculous types in the API hooks.