Skip to content

Commit 5ef68e7

Browse files
committed
Update comments for future me to understand what's going on 🙈
1 parent a01a9a4 commit 5ef68e7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,14 @@ export class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedD
599599
continue;
600600
}
601601

602-
// 2. Handle Fragment selection nodes
603-
// 2a. If `inlineFragmentTypes` is 'combine' or 'mask', the fragment is masked i.e. do not generate inline types
604-
// In some cases like Apollo `@unmask`, the fragment would be generated inline.
602+
// 2. Handle Fragment Spread nodes
603+
// A Fragment Spread can be:
604+
// - masked: the fields declared in the Fragment do not appear in the operation types
605+
// - inline: the fields declared in the Fragment appear in the operation types
606+
607+
// 2a. If `inlineFragmentTypes` is 'combine' or 'mask', the Fragment Spread is masked by default
608+
// In some cases, a masked node could be unmasked (i.e. treated as inline):
609+
// - Fragment spread node is marked with Apollo `@unmask`, e.g. `...User @unmask`
605610
if (this._config.inlineFragmentTypes === 'combine' || this._config.inlineFragmentTypes === 'mask') {
606611
let isMasked = true;
607612

@@ -618,7 +623,7 @@ export class SelectionSetToObject<Config extends ParsedDocumentsConfig = ParsedD
618623
}
619624
}
620625

621-
// 2b. If the Fragment is not masked, handle Fragment Spreads by generating inline types.
626+
// 2b. If the Fragment Spread is not masked, generate inline types.
622627
const fragmentType = this._schema.getType(selectionNode.onType);
623628

624629
if (fragmentType == null) {

0 commit comments

Comments
 (0)