@graphql-tools/delegate 7.0.8-alpha-f9bebbe6.0 → 7.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es5/index.cjs.js CHANGED
@@ -646,8 +646,13 @@ function resolveExternalValue(result, unpathedErrors, subschema, context, info,
646
646
  }
647
647
  function resolveExternalObject(type, object, unpathedErrors, subschema, context, info, skipTypeMerging) {
648
648
  var _a;
649
- var stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo;
649
+ // if we have already resolved this object, for example, when the identical object appears twice
650
+ // in a list, see https://github.com/ardatan/graphql-tools/issues/2304
651
+ if (isExternalObject(object)) {
652
+ return object;
653
+ }
650
654
  annotateExternalObject(object, unpathedErrors, subschema);
655
+ var stitchingInfo = (_a = info === null || info === void 0 ? void 0 : info.schema.extensions) === null || _a === void 0 ? void 0 : _a.stitchingInfo;
651
656
  if (skipTypeMerging || !stitchingInfo) {
652
657
  return object;
653
658
  }
@@ -1539,7 +1544,7 @@ function defaultDelegationBinding(delegationContext) {
1539
1544
  if (stitchingInfo != null) {
1540
1545
  delegationTransforms = delegationTransforms.concat([
1541
1546
  new ExpandAbstractTypes(),
1542
- new AddSelectionSets({}, stitchingInfo.selectionSetsByField, stitchingInfo.dynamicSelectionSetsByField),
1547
+ new AddSelectionSets(stitchingInfo.selectionSetsByType, stitchingInfo.selectionSetsByField, stitchingInfo.dynamicSelectionSetsByField),
1543
1548
  new WrapConcreteTypes(),
1544
1549
  ]);
1545
1550
  }