-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
refactor useQuery to not use an internal class #11869
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
c2bd48b
extract hooks from InternalState
phryneas dc58beb
inline hooks and functions into each other, move `createWatchQueryOpt…
phryneas 10466e5
move `executeQuery` to `useLazyQuery`
phryneas ea77f60
move more functions out
phryneas fde4c4d
move `unsafeHandlePartialRefetch` into `setResult`
phryneas e1b7ed7
remove `toQueryResultCache`, save transformed result in `internalStat…
phryneas 9c865ca
fixup test
phryneas b5e1643
move `getDefaultFetchPolicy` out
phryneas b4c8bf9
move more functions out
phryneas 12e19f9
moved all class methods out
phryneas 24e4491
replace class with single mutable object
phryneas e31d953
move callbacks into their own ref
phryneas 891e211
move `obsQueryFields` out of `internalState`
phryneas ec1c7a9
inline `useInternalState`
phryneas 79566a8
redactor away `internalState.queryHookOptions`
phryneas 873f24d
make function arguments more explicit
phryneas 8bb445c
replace `internalState.watchQueryOptions` with `observable[lastWatchO…
phryneas 635a32b
move observable fully into a readonly prop on internalState
phryneas d6de17f
remove all direct access to `internalState` after initializing
phryneas 06d98ac
extract new `useInternalState` hook
phryneas 7717b4f
extract `useResubscribeIfNecessary` hook
phryneas 3889fff
add comment
phryneas da4b840
extract `bindObservableMethods`
phryneas f18b753
extract `useHandleSkip` and `useRegisterSSRObservable` hooks
phryneas 8480ce6
extract useObservableSubscriptionResult hook
phryneas 30b1769
change some method arguments. remove obsolete comment
phryneas c896885
curry `createMakeWatchQueryOptions`
phryneas 1485651
bring function and hook argyuments into a common order
phryneas 70f5aaf
Move `onQueryExecuted` into `useInternalState`
phryneas fed117b
some style adjustments to be more compiler-friendly
phryneas a69327c
remove R19 exception from test, chores
phryneas 987aaad
Apply suggestions from code review
phryneas 33c0fef
Merge branch 'release-3.11' into pr/rewrite-useQuery
phryneas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@apollo/client": minor | ||
--- | ||
|
||
Rewrite big parts of `useQuery` and `useLazyQuery` to be more compliant with the Rules of React and React Compiler |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"dist/apollo-client.min.cjs": 39619, | ||
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32852 | ||
"dist/apollo-client.min.cjs": 39825, | ||
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32851 | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
🎉 🎉 🎉