graphql-js
graphql-js copied to clipboard
incrementalDelivery: use experimental options rather than experimental functions
Using TS conditional types, when enableExperimental is set to true, return type of execute will correspond to the new types; otherwise, execute will return the old types.
When the option is set to true, incremental results will be delivered; otherwise, the @defer and @stream directives will be ignored.
@glasser @IvanGoncharov @robrichard @n1ru4l https://github.com/orgs/graphql/teams/graphql-js-reviewers
Not so experienced with conditional types, but from the test files, it seems to be working as expected, with the new return type selected only when setting the experimental option enableIncremental to true.
Deploy Preview for compassionate-pike-271cb3 ready!
| Name | Link |
|---|---|
| Latest commit | 011e95c02c678cc54e57043c8ed8d0032fbe188e |
| Latest deploy log | https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/63176a3e0780a90009f095a0 |
| Deploy Preview | https://deploy-preview-3726--compassionate-pike-271cb3.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋
Supported commands
Please post this commands in separate comments and only one per comment:
@github-actions run-benchmark- Run benchmark comparing base and merge commits for this PR@github-actions publish-pr-on-npm- Build package from this PR and publish it on NPM
Now depends on #3727 which is the real alternative to #3722
The main motivation here is to create a flexible foundation if for some reason we need to support multiple experimental flags.
I don't have any strong opinions either way. I think that this change would mean that one could compile against graphql@17 but produce JS that works with graphql@16 without having to do any runtime probing for whether the new function exists, perhaps? Or I guess you'd need to probe graphql version and use that to determine which value to pass.
Yes, you'd need to figure out what value to pass.
Of course, with existing solution you need to figure out which functions to call. The main advantage of the option approach is that if we introduce additional experimental options the number of functions does not become multiplicative.
Closing in favor of #3722.