Skip to content

Commit

Permalink
fix(wrap): get the original schema correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Nov 16, 2022
1 parent 23664a2 commit e3f81ea
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-lobsters-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-tools/wrap': patch
---

Select the original schema correctly
11 changes: 4 additions & 7 deletions packages/wrap/src/transforms/MapLeafValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
transformInputValue,
} from '@graphql-tools/utils';

import { Transform, DelegationContext, SubschemaConfig, Subschema } from '@graphql-tools/delegate';
import { Transform, DelegationContext, SubschemaConfig } from '@graphql-tools/delegate';

import { LeafValueTransformer } from '../types.js';

Expand Down Expand Up @@ -107,12 +107,9 @@ export default class MapLeafValues<TContext = Record<string, any>>
delegationContext: DelegationContext<TContext>,
transformationContext: MapLeafValuesTransformationContext
): ExecutionResult {
return visitResult(
originalResult,
transformationContext.transformedRequest,
(delegationContext.subschema as Subschema<any, any, any, TContext>).schema,
this.resultVisitorMap
);
const schema =
'schema' in delegationContext.subschema ? delegationContext.subschema.schema : delegationContext.subschema;
return visitResult(originalResult, transformationContext.transformedRequest, schema, this.resultVisitorMap);
}

private transformOperations(
Expand Down

0 comments on commit e3f81ea

Please sign in to comment.