Turn NamedFragments with directives always into InlineFragments

This commit is contained in:
Chi Vinh Le
2017-12-01 17:02:45 +01:00
parent 835d30d362
commit 612d2596f9
@@ -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),
};