-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add support for the new incremental format in GraphQL 17.0.0-alpha.9 #12906
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
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.
These tests weren't actually testing defer but a regular query that emitted multiple values. To be honest, I'm not sure how useful these tests are given this should theoretically never happen in a real application (at least for queries). That said, I just removed the @defer
in the queries for now since it was misleading since it wasn't actually testing defer payloads.
).toBeUndefined(); | ||
}); | ||
|
||
it("deduplicates queries as long as a query still has deferred chunks", async () => { |
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've moved @defer
tests to their own subfolders. This test still exists in src/core/__tests__/client.watchQuery/defer20220824.test.tsx
ac7d43f
to
7512b6b
Compare
} | ||
}); | ||
|
||
it('does not suspend deferred queries with data in the cache and using a "cache-and-network" fetch policy', async () => { |
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.
Moved to react/hooks/__tests__/useBackgroundQuery/defer20220824.test.tsx
if (hasDirectives(["defer"], request.query)) { | ||
const context = request.context ?? {}; | ||
const http = (context.http ??= {}); | ||
http.accept = ["multipart/mixed", ...(http.accept || [])]; |
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 need to figure out what the accept
header should be. deferSpec=20220824
doesn't work here anymore, but I don't know if we are replacing it with something else or leaving it bare.
…endingResult` (#4481) Fixes #4333 This change fixes the fields in `FormattedCompletedResult` to match `CompletedResult` (i.e. `id` and `errors`) using the `Formatted*` type variants. This change also adds a `FormattedPendingResult` as an counterpart to `PendingResult` to match the type patterns already established with other `Formatted*` types. I ran into this issue when working on adding support for the new incremental format in Apollo Client (apollographql/apollo-client#12906).
Adds support for using the
@defer
directive with the new incremental delivery format as implemented in[email protected]
.