Skip to content

Commit

Permalink
no need to save ancestors
Browse files Browse the repository at this point in the history
we only use the parent because masking analysis done differently
  • Loading branch information
yaacovCR committed Nov 22, 2023
1 parent a2adbc1 commit 5aefe08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/execution/collectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { getDirectiveValues } from './values.js';

export interface DeferUsage {
label: string | undefined;
ancestors: ReadonlyArray<DeferUsage | undefined>;
parent: DeferUsage | undefined;
}

export type GroupedFieldSet = Map<string, ReadonlyArray<FieldDetail>>;
Expand Down Expand Up @@ -244,10 +244,7 @@ function getDeferUsage(

return {
label: typeof defer.label === 'string' ? defer.label : undefined,
ancestors:
parentDeferUsage === undefined
? [parentDeferUsage]
: [parentDeferUsage, ...parentDeferUsage.ancestors],
parent: parentDeferUsage,
};
}

Expand Down
3 changes: 1 addition & 2 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1454,8 +1454,7 @@ function addNewDeferredFragments(

// For each new deferUsage object:
for (const newDeferUsage of newDeferUsages) {
// DeferUsage objects track their parent targets; the immediate parent is always the first member of this list.
const parentTarget = newDeferUsage.ancestors[0];
const parentTarget = newDeferUsage.parent;

// If the parent target is defined, the parent target is a DeferUsage object and
// the parent result record is the DeferredFragmentRecord corresponding to that DeferUsage.
Expand Down

0 comments on commit 5aefe08

Please sign in to comment.