-
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
Update useLazyQuery
with planned breaking changes
#12367
Open
jerelmiller
wants to merge
207
commits into
release-4.0
Choose a base branch
from
jerel/update-uselazyquery
base: release-4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
207 commits
Select commit
Hold shift + click to select a range
87143e9
Flatten LazyQueryHookOptions type and move inline
jerelmiller 944b377
Flatten LazyQueryHookExecOptions
jerelmiller 676ae30
Remove deprecated QueryTuple type
jerelmiller b4102ed
Remove deprecated LazyQueryResult type
jerelmiller fefe8eb
Remove deprecated QueryLazyOptions type
jerelmiller 23182c8
Move LazyQueryResultTuple type inline
jerelmiller ac7639f
Move LazyQueryExecFunction inline
jerelmiller 933d241
remove Partial from LazyQueryExecFunction
jerelmiller e62e439
Remove old import
jerelmiller f521c05
Remove variables option from hook
jerelmiller dd583a6
Remove defaultOptions from types
jerelmiller 35b453b
Update test to remove variables from hook options
jerelmiller 370e6f4
Remove duplicate test for variables passed to execute
jerelmiller f55b95c
Add todo comment and skip test
jerelmiller a17cad3
Remove variables option and defaultOptions to useLazyQuery
jerelmiller e1a50be
Remove outdated test
jerelmiller 4a8a686
Remove variables option from another test
jerelmiller cdecc24
Add todo comment
jerelmiller 3ad246d
Pass variables to execute function
jerelmiller 0617c16
Move renders around to better show off behavior
jerelmiller 0782cf6
Update option used to test stability
jerelmiller 557d32f
Remove test for defaultOptions
jerelmiller d85d447
Update type test
jerelmiller f1548ee
Inline logic to get default fetch policy
jerelmiller 7152db9
Remove initialFetchPolicy from options
jerelmiller 402d183
Remove most options from LazyQueryExecFunction
jerelmiller bce6a6c
Remove document variable in favor of query
jerelmiller aed5efa
Update test for changing queries to expected new behavior
jerelmiller 52b1aee
Copy implementation of useQuery
jerelmiller fe4c31b
Add check for resolved value from promise in test
jerelmiller 8197cd5
Add assertion on promise in test
jerelmiller 1f061b2
Move assertion up
jerelmiller ebc48da
Check result of promise in test
jerelmiller cec0d95
Check result of promise in test
jerelmiller c29f091
Check result of promise in test
jerelmiller 33d4169
Add todo comment
jerelmiller af21fda
Add check for promise in test
jerelmiller 73870ba
Check result of promise in test
jerelmiller 1c4ac9c
Remove duplicate test
jerelmiller b0cf680
Add todo comments
jerelmiller 1d9ed7e
Reorganize test slightly
jerelmiller 5d71d25
Inline checks for network errors
jerelmiller e58569d
Add test for changing clients
jerelmiller 2c2e15d
Add test for changing variables with cache updates
jerelmiller 9288667
Add test for checking cached result
jerelmiller 4208c02
Add test to check changing error policies
jerelmiller e302499
Add test to check for changing context
jerelmiller dabc788
Add test to check for changing refetchWritePolicy
jerelmiller 66245cc
Add test to check changing returnPartialData
jerelmiller f05fe7d
Add test to check changing fetchPolicy
jerelmiller 244b727
Remove unused import
jerelmiller e4409a6
Skip all but first test
jerelmiller 4d65a0d
Remove code to get fetch policy from executeOptions
jerelmiller 000b770
Change type passed to useCallback
jerelmiller e314b59
Create new LazyQueryResult type and use in useLazyQuery
jerelmiller de14bc4
Inline ObservableQueryFields
jerelmiller 02fcb42
Add todo tests for throwing before execute function is called
jerelmiller 5a069c8
Add a toEqualLazyQueryResult matcher
jerelmiller 0962672
Use toEqualLazyQueryResult in useLazyQuery tests
jerelmiller 24b43d7
Make type of observable undefined
jerelmiller 4f7e3c7
Check that observable is undefined, then defined
jerelmiller f62ffc8
Expect undefined variables and no error property on initial result
jerelmiller 2e6d551
First pass at getting results from useLazyQuery
jerelmiller 5199de7
Don't set options yet
jerelmiller 0d981ea
Always set observable. Ensure fetchPolicy is properly set
jerelmiller bd9b474
Add additional fields to returned promise
jerelmiller 8d91312
Return client and observable in promise result
jerelmiller b8bb50b
Add todo comment
jerelmiller ea8c368
Revert check on variables and observable in test
jerelmiller 2d7952f
Rerender when setting initial result
jerelmiller d25f431
Remove unneeded refs
jerelmiller fec54de
Set previous when changing results
jerelmiller 0832d62
Enable more passing tests
jerelmiller 1da6a27
Remove unneeded ?
jerelmiller 975ac26
Check options.fetchPolicy first
jerelmiller debeeb0
Change order of execution
jerelmiller 5b72b73
Enable another test
jerelmiller 2b9d723
Add todo comment
jerelmiller 8fb881f
Only set previousData if there was data
jerelmiller a7b5d72
Handle changing queries
jerelmiller 4e9637b
Handle multiple executions of useLazyQuery
jerelmiller 1478ce2
Remove unused import
jerelmiller 6344572
Handle refetch
jerelmiller 7f4251c
Update todo comment
jerelmiller e1ed07d
Add todo comment
jerelmiller 1df9d7d
Handle changing variables
jerelmiller 22788cf
Add todo comment
jerelmiller 741bfc1
Enable another test
jerelmiller e9feb64
Add todo comment
jerelmiller b7a1887
Switch to await
jerelmiller d39a50b
Check result of promise in test
jerelmiller 8cea67b
Update expected behavior in test
jerelmiller 244b349
Update test description
jerelmiller 695d31b
Add error handling to useLazyQuery
jerelmiller ade8c2c
Add todo comment
jerelmiller 10d3ac4
Add todo comment
jerelmiller 9605fee
Allow in flight promise to resolve when calling execute
jerelmiller 2fdcc10
Enable more tests
jerelmiller 0068408
Enable another test
jerelmiller 133a541
Remove error from checked initial value
jerelmiller 1241e59
Update test on expected behavior for network error
jerelmiller c68c37c
Update test on expected behavior for network error
jerelmiller fe8e371
Update test on expected behavior for network error
jerelmiller 81278d8
Update expected behavior for clearStore
jerelmiller 076f80a
Handle masking
jerelmiller a8b0be2
Enable masking tests
jerelmiller 5952075
Handle changing clients
jerelmiller f8ce897
Fix some incorrect assertions
jerelmiller 1cb1bbc
Enable another test
jerelmiller cbaa0b0
Fix some assertions
jerelmiller e0d9b03
Add some delay on emitted value
jerelmiller a4d0425
temp comment out error handling for changed error policy
jerelmiller a784ac2
Fix some assertions and use network-only to check context changes
jerelmiller b110e68
Handle changing errorPolicy and context
jerelmiller c84a9be
Minor tweak to test to check for context change on refetch
jerelmiller a785dcf
Fix some assertions and ensure refetchWritePolicy is honored
jerelmiller d1d6303
Fix some assertions
jerelmiller b29c8c7
Handle partial data changing between renders
jerelmiller eb625f7
Fix some assertions
jerelmiller 64022bd
Don't set data to undefined when changing queries
jerelmiller 9022b4b
Combine conditionals
jerelmiller 35eb982
Remove unused copied code
jerelmiller 34b53c7
Remove special handling of observable query methods
jerelmiller cbbca59
Stop exporting private functions from useQuery
jerelmiller c67e0cc
Return an ApolloQueryResult from the execute function
jerelmiller 70274f7
Remove test
jerelmiller 125e0d5
Remove unused variable
jerelmiller 8114601
Add check for no additional renders where necessary
jerelmiller 6ee6018
Add todo comment
jerelmiller 90e65cb
Add test for notifyOnNetworkStatusChange
jerelmiller 44ef2fa
Add test for network-only with notifyOnNetworkStatusChange
jerelmiller b28486c
Add todo comment
jerelmiller 25ca3f5
Change test description
jerelmiller 3a2bb6a
Add test for changing queries with notifyOnNetworkStatusChange
jerelmiller f7452d3
Add test for changing variables with notifyOnNetworkStatusChange
jerelmiller c27624d
Add test for multiple execution with cache-and-network fetch policy
jerelmiller 7debdb1
Add test for cache-and-network when changing variables
jerelmiller 7f2582d
Add test for cache-and-network with notifyOnNetworkStatusChange
jerelmiller 6d5d7d1
Remove test covered by other tests
jerelmiller 3bbb248
Change test description
jerelmiller b7c365f
Don't render loading states unless notifyOnNetworkStatusChange is true
jerelmiller a7a4bce
Handle changes for notifyOnNetworkStatusChange
jerelmiller bfa6722
Only update previousData if `data` changes
jerelmiller b22647c
Get ssr working
jerelmiller f289068
Consolidate variable
jerelmiller 0ff9316
Move ssr logic into execute function
jerelmiller 656ecbb
Remove unused dirtyRef
jerelmiller 8cd05aa
Add todo comment
jerelmiller e9102ad
Remove unneeded dependency for eagerMethods
jerelmiller 2b240b4
Bind observable query methods inline
jerelmiller e1f57b1
Enable test
jerelmiller 7092a49
Enable test for multiple calls
jerelmiller 9ab8e9e
Add back todo
jerelmiller 96bfcab
Set initialFetchPolicy as passed in fetchPolicy when creating the obs…
jerelmiller 2ef460b
Better initial fetch policy
jerelmiller aa5b91c
Move call to force update in updateResult
jerelmiller dc850e0
Ensure changes to fetchPolicy take place immediately
jerelmiller 43b8593
Add todo comment
jerelmiller b63c3bd
Enable test switching to cached value
jerelmiller e6656d3
Add test with changing variables on cached result with notifyOnNetwor…
jerelmiller 7c3bff0
Add comment
jerelmiller c7c530e
Add todo comment
jerelmiller 3b4fad1
Remove unused dependencies
jerelmiller 169ae03
Address lint issues
jerelmiller 0b2b70e
Fix ts issues in useQuery
jerelmiller 5710ae6
Fix lint issue
jerelmiller ef94e50
Update useQuery tests that use useLazyQuery
jerelmiller 82340cb
Remove ssr support for useLazyQuery
jerelmiller 5981717
Throw when calling execute during render
jerelmiller db0d247
Remove support for reobserve in useLazyQuery
jerelmiller 0723df0
Add more todo tests
jerelmiller c733349
Throw when calling query functions for query that hasn't been executed
jerelmiller af453c6
Remove unneeded eslint disable rule
jerelmiller d67a52b
Ensure `this` is set to observable
jerelmiller 13d6215
Fix lazy query result type in useQuery tests
jerelmiller 9769b71
Add back lint disable
jerelmiller 8543aca
Use SubscribeToMoreFunction in useLazyQuery
jerelmiller 8494625
Use UpdateQueryMapFn in updateQuery option
jerelmiller e1b15bf
Enforce variables option on execute with required variables
jerelmiller 5e57bb0
Fix TS issue with execute function
jerelmiller 402c3a2
Apply the query immediately rather than waiting for next execute call
jerelmiller 0ad76aa
Throw when calling execute in a non-browser environment
jerelmiller fd15510
Add changesets
jerelmiller e0f7cf6
Add test for checking execute function resolves with errorPolicy: 'all'
jerelmiller 45f4334
Add test for error policy ignore
jerelmiller 29404af
Add another changeset
jerelmiller d5aee27
Remove some todos
jerelmiller c2f82c4
Rerun api report
jerelmiller a7a90bd
Minor tweak to changeset
jerelmiller 95bcb3c
Remove unneeded skip on type tests
jerelmiller eaa59f4
Remove unused properties returned from useQueryInternals
jerelmiller 6243045
Remove unused onQueryExecuted callback
jerelmiller 0cd4e8d
Don't return tuple fro useInternalState
jerelmiller 9320d6d
Move creation of obsQueryFields closer to usage
jerelmiller 109ca40
Return result directly from useQueryInternals
jerelmiller 7a81ae8
Tweak changeset
jerelmiller 7c09cec
Tweak changeset on new default
jerelmiller 5fa396c
Remove check for React 19 in test
jerelmiller 40c8637
Update advice in changeset
jerelmiller b38f641
Update changeset
jerelmiller 61f8804
Remove unneeded dependency
jerelmiller c63b207
Inline use of hasOwnProperty
jerelmiller a632f66
Simplify value of initialFetchPolicy
jerelmiller 547dd45
Add todo comment
jerelmiller 861e23c
Remove check for window object
jerelmiller 4d17c2a
Only return initial result on server
jerelmiller 5dcb2df
Move creation of result variable right before its used
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
Simplify value of initialFetchPolicy
- Loading branch information
commit a632f66d881016ac82db47f4ef37b7795a08a595
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.
We wanted to change the default value for
notifyOnNetworkStatusChange
totrue
in 4.0. I'm going to reserve this for a separate PR and do this in core so that this change is consistent across the client.