Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
fix(transforms): cloneSchema prior to transformSchema
Browse files Browse the repository at this point in the history
This allows individual schema transforms to save intermediate schema representations even if other schema transformations modify them in place.
  • Loading branch information
yaacovCR committed Nov 27, 2019
1 parent 372dcdd commit b2bda0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/transforms/transforms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GraphQLSchema } from 'graphql';
import { Request, Transform } from '../Interfaces';
import { cloneSchema } from '../utils';

export { Transform };

Expand All @@ -9,7 +10,7 @@ export function applySchemaTransforms(
): GraphQLSchema {
return transforms.reduce(
(schema: GraphQLSchema, transform: Transform) =>
transform.transformSchema ? transform.transformSchema(schema) : schema,
transform.transformSchema ? transform.transformSchema(cloneSchema(schema)) : schema,
originalSchema,
);
}
Expand Down

0 comments on commit b2bda0e

Please sign in to comment.