Skip to content

Commit

Permalink
move function to help with overall diff
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Nov 22, 2022
1 parent 48fe4e2 commit 26002c8
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2094,6 +2094,28 @@ async function executeStreamIterator(
}
}

function filterSubsequentPayloads(
exeContext: ExecutionContext,
nullPath: Path,
currentAsyncRecord: AsyncPayloadRecord | undefined,
): void {
const nullPathArray = pathToArray(nullPath);
exeContext.publisher.filter((asyncRecord) => {
if (asyncRecord === currentAsyncRecord) {
// don't remove payload from where error originates
return true;
}
for (let i = 0; i < nullPathArray.length; i++) {
if (asyncRecord.path[i] !== nullPathArray[i]) {
// asyncRecord points to a path unaffected by this payload
return true;
}
}

return false;
});
}

function toIncrementalResult(
asyncPayloadRecord: AsyncPayloadRecord,
): IncrementalResult {
Expand Down Expand Up @@ -2123,28 +2145,6 @@ function toPayload(
return incremental.length ? { incremental, hasNext } : { hasNext };
}

function filterSubsequentPayloads(
exeContext: ExecutionContext,
nullPath: Path,
currentAsyncRecord: AsyncPayloadRecord | undefined,
): void {
const nullPathArray = pathToArray(nullPath);
exeContext.publisher.filter((asyncRecord) => {
if (asyncRecord === currentAsyncRecord) {
// don't remove payload from where error originates
return true;
}
for (let i = 0; i < nullPathArray.length; i++) {
if (asyncRecord.path[i] !== nullPathArray[i]) {
// asyncRecord points to a path unaffected by this payload
return true;
}
}

return false;
});
}

class DeferredFragmentRecord {
type: 'defer';
errors: Array<GraphQLError>;
Expand Down

0 comments on commit 26002c8

Please sign in to comment.