mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
@@ -1139,16 +1139,26 @@ export class GraphQLService {
|
||||
): readonly SelectionNode[] | null {
|
||||
if (!selections) return null;
|
||||
|
||||
return flatten(
|
||||
const result = flatten(
|
||||
selections.map((selection) => {
|
||||
// Fragments can contains fragments themselves. This allows for nested fragments
|
||||
if (selection.kind === 'FragmentSpread') {
|
||||
// Fragments can contains fragments themselves. This allows for nested fragments
|
||||
return this.replaceFragmentsInSelections(fragments[selection.name.value].selectionSet.selections, fragments);
|
||||
}
|
||||
|
||||
// Nested relational fields can also contain fragments
|
||||
if (selection.kind === 'Field' && selection.selectionSet) {
|
||||
selection.selectionSet.selections = this.replaceFragmentsInSelections(
|
||||
selection.selectionSet.selections,
|
||||
fragments
|
||||
) as readonly SelectionNode[];
|
||||
}
|
||||
|
||||
return selection;
|
||||
})
|
||||
).filter((s) => s) as SelectionNode[];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
injectSystemResolvers(
|
||||
|
||||
Reference in New Issue
Block a user