From 612d2596f9e907549eea0e0f22c1bd9740cca556 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 1 Dec 2017 17:02:45 +0100 Subject: [PATCH] Turn NamedFragments with directives always into InlineFragments --- client/coral-framework/graphql/reduceDocument.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/coral-framework/graphql/reduceDocument.js b/client/coral-framework/graphql/reduceDocument.js index a713f8078..d3d5990bf 100644 --- a/client/coral-framework/graphql/reduceDocument.js +++ b/client/coral-framework/graphql/reduceDocument.js @@ -129,7 +129,7 @@ function getTransformedSelections(definition, path, gqlType, execContext) { const typeCondition = fragment.typeCondition.name.value; // Turn NamedFragment into an InlineFragment. - if (gqlType !== typeCondition) { + if (gqlType !== typeCondition || fragment.directives.length) { const node = { ...fragment, kind: 'InlineFragment', @@ -215,7 +215,6 @@ export default function reduceDocument(document, options = {}) { const execContext = { rawFragmentMap: createFragmentMap(fragments), fragmentMap: options.fragmentMap || {}, - keepFragments: [], variables: options.variables, typeGetter: options.typeGetter || (() => null), };