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

Make batch delegate send key arrays to loadMany #1865

Merged
merged 3 commits into from Aug 2, 2020

Conversation

gmac
Copy link
Contributor

@gmac gmac commented Jul 31, 2020

It's not uncommon for a model to posses an array of keys to be stitched from another service, for example:

type Post {
  networkIds: [ID!]!
}

In these cases, the array of keys are delegated through DataLoader.loadMany so that the results return an array of mapped models. This PR adds this behavior. While at it, I've added eager returns for skipping delegation entirely when a key or key set is empty.

TODO:

  • If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
  • 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

@gmac gmac requested a review from yaacovCR August 1, 2020 03:01
@yaacovCR yaacovCR merged commit 7c55fbe into ardatan:master Aug 2, 2020
@theguild-bot
Copy link
Collaborator

The latest changes of this PR are available as alpha in npm: 6.0.16-alpha-7c55fbe4.0

Quickly update your package.json by running:

npx match-version @graphql-tools 6.0.16-alpha-7c55fbe4.0

@gmac gmac deleted the gm-batch-delegate-many branch January 8, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants