-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(query-core, react-query): backport v5 types, deprecate isLoading
in favor of isPending
in mutation observer results
#9266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…vor of `isPending` in mutation observer results
View your CI Pipeline Execution ↗ for commit 569efbb.
☁️ Nx Cloud last updated this comment at |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 569efbb:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v4 #9266 +/- ##
==========================================
- Coverage 95.16% 91.62% -3.54%
==========================================
Files 13 117 +104
Lines 496 4478 +3982
Branches 179 1184 +1005
==========================================
+ Hits 472 4103 +3631
- Misses 23 344 +321
- Partials 1 31 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left comments with intentions
@@ -136,7 +136,6 @@ export function useQuery< | |||
'queryKey' | 'queryFn' | |||
>, | |||
): UseQueryResult<TData, TError> | |||
/** @deprecated */ | |||
export function useQuery< | |||
TQueryFnData, | |||
TError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be marked as deprecated
onSuccess: undefined, | ||
onError: undefined, | ||
onSettled: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User can't use callbacks(onSuccess, onError, onSettled) not only typescriptly
/** | ||
* @deprecated This property will be removed in the next major version. Use `isPending` instead. | ||
*/ | ||
isLoading: boolean | ||
isPending: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export { useQuery } from './useQuery' | ||
export { useSuspenseQuery } from './useSuspenseQuery' | ||
export { useSuspenseQueries } from './useSuspenseQueries' | ||
export type { | ||
SuspenseQueriesResults, | ||
SuspenseQueriesOptions, | ||
} from './useSuspenseQueries' | ||
export { queryOptions } from './queryOptions' | ||
export type { | ||
DefinedInitialDataOptions, | ||
UndefinedInitialDataOptions, | ||
} from './queryOptions' | ||
export { | ||
defaultContext, | ||
QueryClientProvider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLoading
in favor of isPending
in mutation observer resultsisLoading
in favor of isPending
in mutation observer results
Deprecation and Property to enhance migration to v5 gradually:
isLoading
property as deprecated in multipleMutationObserver
result interfaces (MutationObserverBaseResult
,MutationObserverIdleResult
,MutationObserverLoadingResult
,MutationObserverErrorResult
,MutationObserverSuccessResult
) and added theisPending
property as its replacement.Type backport like v5:
UseSuspenseQueryOptions
,UseSuspenseQueryResult
,SuspenseQueriesResults
,SuspenseQueriesOptions
,DefinedInitialDataOptions
, andUndefinedInitialDataOptions
,DefinedInitialDataOptions
andUndefinedInitialDataOptions
types like v5Many people are still on v4, and the same is true for my company.
If we backport some of the v5 APIs to v4 well, it would ease their migration and reduce friction. This can help accelerate the adoption of v5 eventually, allowing us to concentrate our efforts on v5 improvements.
What I want to backport after this Pull Request
useSuspenseInfiniteQuery
infiniteQueryOptions