-
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
Adds support for skipToken
in options for useSuspenseQuery
and useBackgroundQuery
and soft deprecates skip
option
#11112
Merged
Merged
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
6456222
Create a skipToken constant
jerelmiller dac769e
Get working types for skipToken with useSuspenseQuery
jerelmiller 7a3fa2a
Add comment explaining when condition occurs
jerelmiller fbee9e4
Remove unneeded bind in constructor
jerelmiller d88a870
Update comment about comparison
jerelmiller 4afa483
Add comment explaining why getCurrentResult has false
jerelmiller 7890d2f
Pass cache key inline to getQueryRef
jerelmiller 8263ec0
Move call to suspense cache inline
jerelmiller 5a14383
Pass undefined to useApolloClient when options is set to skip token
jerelmiller 95e8c08
Don't use destructured values from options
jerelmiller 4d7de45
Use options.variables for query ref key
jerelmiller b004d6a
Compute fetchPolicy in render
jerelmiller c1ced40
Remove client from useWatchQueryOptions
jerelmiller ae6ccfd
Move validation of options to custom hook
jerelmiller cfb1463
Update function signature of validateOptions
jerelmiller 6af7cde
Create watchQueryOptions in render
jerelmiller 66196ba
Move watch query option overrides to constant
jerelmiller 6aea24d
Move query in all spreads
jerelmiller 6352f5a
Refactor to options everywhere
jerelmiller 000a8c3
No need to pass query when checking if options changed
jerelmiller 4b1a606
Allow skiptoken in validation
jerelmiller 4d57e2b
Handle skip token set as options
jerelmiller aa24879
Add test to validate using skip token after already run maintains data
jerelmiller 9a73240
Simplify test with skipToken
jerelmiller ee16166
Add missing skipToken import
jerelmiller 0fdaef1
Abstract a watchQueryOptions variable
jerelmiller e887a17
Add additional tests for skipToken with options
jerelmiller ad7d364
Remove unused import
jerelmiller a9280aa
Use a fulfilled promise for the skip result
jerelmiller 604eef2
Extract skip result logic to function
jerelmiller c4d3c9c
Handle undefined result
jerelmiller 1501ded
Remove support for `skipToken` as the `query` to `useSuspenseQuery`
jerelmiller 0948cf0
Consolidate validateOptions into useValidateOptions and remove SkipTo…
jerelmiller f82c4dc
Create an internal useValidateSuspenseHookOptions hook
jerelmiller 9591153
Add test that validates supported fetchPolicy from global options
jerelmiller 5fdfbab
Don't publicly export refetch/fetchmore/subscribetoMore function types
jerelmiller 0fddf36
Restore implementation to pre-refactor stage and get it working with …
jerelmiller 96612ed
Fix import of RefetchFunction and FetchMoreFunction
jerelmiller a5a11f3
Run prettier on useBackgroundQuery test file
jerelmiller 874c7d6
Remove useValidateSuspenseHookOptions
jerelmiller b4b54f6
Update return type of useBackgroundQuery test
jerelmiller 5a90f53
No need for React.useMemo on returned tuple from useBackgroundQuery
jerelmiller 28fff6a
Return undefined from useBackgroundQuery when skipping for the first …
jerelmiller 2640b52
Allow prettier to format useReadQuery
jerelmiller 6de296e
Remove unneeded skipResult check in useReadQuery
jerelmiller 5e3e46e
Add missing TVariables in useBackgroundQuery hook
jerelmiller 2383535
WIP add support for skip token in useBackgroundQuery
jerelmiller f5cdbef
Add additional type test to ensure undefined options are set correctly
jerelmiller 85a49f2
Fix type when using skip token with/without returnPartialData
jerelmiller 84038f2
Remove unused import
jerelmiller 0acae4c
Use helper to wrap/unwrap query ref
jerelmiller 3a01bed
Add additional overload to handle constant skip token
jerelmiller b935463
Add additional skip tests when using `skipToken`
jerelmiller 94938bf
Add deprecated tag to skip option in types
jerelmiller 10e7eb0
Add changeset
jerelmiller 2cdaf1d
Merge branch 'release-3.8' into skip-token
jerelmiller 1bd90c7
Better comment about tracking skip state
jerelmiller d6b9637
Import invariant from globals/index in useReadQuery
jerelmiller b9a512b
Fix reference to wrong value in useReadQuery useEffect
jerelmiller 9c4930f
useSyncExternalStore to update promise cache in useReadQuery
jerelmiller ed10a80
Add additional comment about removal of skip option in changeset
jerelmiller bf20335
Use `Symbol.for` with `skipToken` and update to use apollo.* namespace
jerelmiller 57dee8e
Use type export for `SkipToken` type
jerelmiller a6529c6
Use type condition with never to handle union with undefined when ski…
jerelmiller 761f6bd
Use Partial on internal hook signature to avoid additional code to sa…
jerelmiller 1e31b27
Add code example to deprecated `skip` option tsdoc
jerelmiller 99c2881
Use destructured promiseCache when setting key
jerelmiller c64b15f
Return `undefined` type when using unconditionl `skipToken` for `useB…
jerelmiller 1e5a844
Add checks to skip tests to ensure text isn't hidden because its susp…
jerelmiller 6c861b2
Better test description for skip token test
jerelmiller 2f6cc8b
Update test for swapping skip back and forth to change variables to e…
jerelmiller 35a0240
Merge remote-tracking branch 'origin/release-3.8' into skip-token
jerelmiller 569df84
useMemo the wrapped query ref
jerelmiller 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
Import invariant from globals/index in useReadQuery
- Loading branch information
commit d6b9637dca73606f78f6651772fbfa4b51402d60
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
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.
I happened to notice we were importing this function from the wrong place. This has been updated to ensure its using the wrapped version.