Skip to content
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

re-implement support for @defer directive #2181

Closed

Conversation

lilianammmatos
Copy link

@lilianammmatos lilianammmatos commented Jan 14, 2019

I created this PR to get the @defer changes up-to-date with master because we'd like to start using this feature internally. I'm opening this PR in-case it's useful to any one else!


This PR reimplements the proposed addition of @defer support to Apollo Server originally proposed by @clarencenpy. Full details of the proposed spec can be found here.

TODO:

  • Update CHANGELOG.md (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

Via the original pull request:

Summary:

  • This PR uses a modified version execute.js from graphql.js. Functions that are untouched have been removed, and exported from graphql directly.
  • execute() returns ExecutionResult | DeferredExecutionResult, the latter being if @defer has been applied to any fields.
  • DeferredExecutionResult wraps an ExecutionResult containing the initial response, and an AsyncIterable.

Testing:

  • I have extended the star wars test suite to add tests for @defer, while making sure that all the other tests are still passing. Tests are in __tests__/starWarsDefer-test.ts

@apollo-cla
Copy link

@lilianammmatos: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@Xample
Copy link

Xample commented Mar 19, 2019

What is the status of this PR ? Is or will it be any official support from the Apollo team?

Copy link

@jamiter jamiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some feedback but removed it because the actual code was added in #1287

Please disregard this.

@lilianammmatos
Copy link
Author

Hi everyone! I, along with my colleague @robrichard, have been working on adding support for Relay-compatible @defer and @stream directives to Graphql.js in hopes of these directives making their way to the official GraphQL spec! We've opened a pull request already for these updates: graphql/graphql-js#2319

I'll be closing this pull request as this approach is not compatible with Relay's @defer implementation.

@lilianammmatos lilianammmatos deleted the defer-support-updated branch December 31, 2019 17:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants