-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incrementally re-render results after
refetch
or skip
when using …
…`@defer` with `useSuspenseQuery` (#11035) When issuing a query with an `@defer` directive, calling refetch or enabling a query by disabling the skip option would only re-render when the entire result was loaded. This felt like it defeated the purpose of the `@defer` directive in these cases. This adds the ability to incrementally re-render results returned by `@defer` queries to match the behavior of the initial fetch. This also makes a first attempt at refactoring some of `QueryReference` to remove flag-based state and replace it with a status enum. NOTE: This attempts to add support for incrementally re-rendering `fetchMore`, but there is currently a bug in core that prevents this from happening. A test has been added that documents the existing behavior for completeness.
- Loading branch information
1 parent
4555ff7
commit a3ab745
Showing
7 changed files
with
1,388 additions
and
177 deletions.
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': patch | ||
--- | ||
|
||
Incrementally re-render deferred queries after calling `refetch` or setting `skip` to `false` to match the behavior of the initial fetch. Previously, the hook would not re-render until the entire result had finished loading in these cases. |
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
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.