graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

incrementalDelivery: use experimental options rather than experimental functions

Open yaacovCR opened this issue 3 years ago • 7 comments

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.

yaacovCR avatar Sep 06 '22 12:09 yaacovCR

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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Sep 06 '22 12:09 netlify[bot]

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

github-actions[bot] avatar Sep 06 '22 12:09 github-actions[bot]

Now depends on #3727 which is the real alternative to #3722

yaacovCR avatar Sep 06 '22 15:09 yaacovCR

The main motivation here is to create a flexible foundation if for some reason we need to support multiple experimental flags.

yaacovCR avatar Sep 06 '22 16:09 yaacovCR

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.

glasser avatar Sep 08 '22 23:09 glasser

Yes, you'd need to figure out what value to pass.

yaacovCR avatar Sep 09 '22 07:09 yaacovCR

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.

yaacovCR avatar Sep 09 '22 07:09 yaacovCR

Closing in favor of #3722.

yaacovCR avatar Sep 28 '22 17:09 yaacovCR