-
-
Notifications
You must be signed in to change notification settings - Fork 833
Description
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches yours. - 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
When using batchDelegateToSchema, the cacheKey for fetching a memoized loader is created using either the requested field name (for fields returning scalars) or the field name + selection set (for fields returning composites). When using this in conjunction with non-key arguments (for instance via argsFromKeys), those arguments do not effect the cacheKey. Thus, delegating the same field multiple times with different arguments only ever result in one delegation.
Possible solution is to use the entire field node (with alias redacted) instead of only the selection set when creating the cache key. This seems to solve the problem, afaik (see related PR).
To Reproduce
Steps to reproduce the behavior:
See unit tests in related pull request.
Expected behavior
Delegate resolvers should run once for every set of non-key arguments passed to batchDelegateToSchema.
Environment:
- OS:
@graphql-tools/batch-delegate: 8.4.25- NodeJS: v16.13.2