You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi — in case folks are watching this discussion but not the graphql-js repo, I just want to highlight this PR of mine: graphql/graphql-js#3703
This PR doesn't affect the defer/stream wire protocol, just graphql-js. It does a few things:
(a) Changes the way you detect whether execute returned a single result vs a series of results from "probe the object directly using a type-guard function to see if it is an async iterator" to "see if the object has a field named initialResult on it"
(b) Separates the "initial result" (available immediately) from the stream of "subsequent results". This makes sense because they have different structures!
(c) Makes the TypeScript types for "only result from non-incremental-delivery execution", "initial result of incremental-delivery execution", and "subsequent result" separate and precise. (Previously, for kinda technical reasons, hasNext and incremental had invaded the main ExecutionResult interface.)
(d) Fixes the Formatted*ExecutionResult set of types to ensure that incremental.errors is GraphQLFormattedError (this one is a straight-up bug fix IMO).
((a) through (c) are all kinda intertwined with each other.)
I found that these changes made implementing support for defer/stream in Apollo Server much more natural.
Probably best to have discussion on the PR rather than here but just wanted to highlight it!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi — in case folks are watching this discussion but not the graphql-js repo, I just want to highlight this PR of mine: graphql/graphql-js#3703
This PR doesn't affect the defer/stream wire protocol, just graphql-js. It does a few things:
(a) Changes the way you detect whether
execute
returned a single result vs a series of results from "probe the object directly using a type-guard function to see if it is an async iterator" to "see if the object has a field namedinitialResult
on it"(b) Separates the "initial result" (available immediately) from the stream of "subsequent results". This makes sense because they have different structures!
(c) Makes the TypeScript types for "only result from non-incremental-delivery execution", "initial result of incremental-delivery execution", and "subsequent result" separate and precise. (Previously, for kinda technical reasons,
hasNext
andincremental
had invaded the mainExecutionResult
interface.)(d) Fixes the
Formatted*ExecutionResult
set of types to ensure thatincremental.errors
is GraphQLFormattedError (this one is a straight-up bug fix IMO).((a) through (c) are all kinda intertwined with each other.)
I found that these changes made implementing support for defer/stream in Apollo Server much more natural.
Probably best to have discussion on the PR rather than here but just wanted to highlight it!
Beta Was this translation helpful? Give feedback.
All reactions