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

Introduce batch delegation #1735

Merged
merged 5 commits into from Jul 8, 2020
Merged

Introduce batch delegation #1735

merged 5 commits into from Jul 8, 2020

Commits on Jul 8, 2020

  1. fix memoization

    = memoize info using info.fieldNodes, which is memoized by upstream graphql-js
    
    = refactor StitchingInfo type and handleObject and supporting methods to use consistent keys to enable memoization
    yaacovCR committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    79e3c13 View commit details
    Browse the repository at this point in the history
  2. reorganize delegate files

    yaacovCR committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    70443c8 View commit details
    Browse the repository at this point in the history
  3. add batchDelegate package

    Add key option within type merging config to enable batch loading for lists.
    
    This minimal version of batching uses cached dataLoaders to create a separate batch for each list rather than for every similar query within the resolution tree.
    
    This is because a new dataloader is created for every new info.fieldNodes object, which is memoized upstream by graphql-js within resolution of a given list to allow the loader to be used for items of that list.
    
    A future version could provide an option to batch by similar target fieldName/selectionSet, but this version may hit the sweet spot in terms of code complexity and batching behavior.
    
    see:
    #1710
    yaacovCR committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    59b5606 View commit details
    Browse the repository at this point in the history
  4. further reorganize

    remove unused isProxiedResult function
    
    move unwrapResult and dehoistResult into createMergedResolver
    
    WrapFields and HoistField transforms now use their own unwrapping and dehoisting logic, so these functions should be located only to the file that used them
    yaacovCR committed Jul 8, 2020
    Configuration menu
    Copy the full SHA
    c224820 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d6b7287 View commit details
    Browse the repository at this point in the history