Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ describe('Validate: Defer/Stream directive on root field', () => {
},
]);
});
it('Fragment spread cycle on root mutation field', () => {
expectValid(`
mutation {
...rootFragment
}
fragment rootFragment on MutationRoot {
...otherFragment
}
fragment otherFragment on MutationRoot {
...rootFragment
}
`);
});
it('Self-referencing fragment spread on root mutation field', () => {
expectValid(`
mutation {
...rootFragment
}
fragment rootFragment on MutationRoot {
...rootFragment
}
`);
});
it('Defer inline fragment spread on root mutation field', () => {
expectErrors(`
mutation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ function forbidDeferStream({
if (visitedFragments.has(fragmentName)) {
continue;
}
visitedFragments.add(fragmentName);
const fragment = fragments.get(fragmentName);
if (fragment) {
const defer = getDeferDirective(selection);
Expand All @@ -141,7 +142,6 @@ function forbidDeferStream({
visitedFragments,
});
}
visitedFragments.add(fragmentName);
} else if (selection.kind === 'InlineFragment') {
const defer = getDeferDirective(selection);
if (defer !== undefined) {
Expand Down
Loading