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
[legacy-framework] Breaking: Upgrade React Query to v2 #720
Conversation
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.
Awesome, thank you! Can you also open a PR to https://github.com/blitz-js/blitzjs.com to update the needed doc changes?
@@ -22,7 +22,7 @@ const Products = () => { | |||
))} | |||
|
|||
<div> | |||
<button onClick={() => fetchMore()} disabled={!canFetchMore || isFetchingMore}> | |||
<button onClick={() => fetchMore()} disabled={!canFetchMore || !!isFetchingMore}> |
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.
Why this change?
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 is because the type of disabled
is a boolean but the type of isFetchingMore
has been changed from boolean
to false | 'previous' | 'next'
.
packages/core/package.json
Outdated
@@ -43,7 +43,7 @@ | |||
"@blitzjs/config": "0.15.3", | |||
"@blitzjs/display": "0.15.3", | |||
"pretty-ms": "6.0.1", | |||
"react-query": "1.5.8", | |||
"react-query": "^2.4.4", |
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 needs pinned to an exact version :)
"react-query": "^2.4.4", | |
"react-query": "2.4.4", |
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.
Fixed
By the way, always make sure your PRs have |
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.
Great, thank you!
This PR closes the issue of Upgrade React Query to v2. blitz-js/legacy-framework#691
What are the changes and their implications?
Affected Change List
useQuery(ready && queryKey, queryFn)
useQuery(queryKey, queryFn, { enabled: ready })
useQuery(() => ['user', user.id], queryFn)
useQuery(['user', user?.id], queryFn, { enabled: user?.id })
refetchQueries
has been renamed toinvalidateQueries
. You will need make this rename change for your app to continue working propertly. The name change comes due to some differences in what the function does.queryKey
used inrefetchQueries(queryKey)
and were also stale, would be refetched... even queries that were inactive and not rendered on the screen. This resulted in quite a few queries being refetched regardless of their immediate necessity.isFetchingMore
inInfiniteQueryResult
has been changed fromboolean
tofalse | 'previous' | 'next'
.Checklist