Skip to content

Commit 189519a

Browse files
committed
move function to help with overall diff
1 parent 84899da commit 189519a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/execution/execute.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,28 @@ async function executeStreamIterator(
20942094
}
20952095
}
20962096

2097+
function filterSubsequentPayloads(
2098+
exeContext: ExecutionContext,
2099+
nullPath: Path,
2100+
currentAsyncRecord: AsyncPayloadRecord | undefined,
2101+
): void {
2102+
const nullPathArray = pathToArray(nullPath);
2103+
exeContext.publisher.filter((asyncRecord) => {
2104+
if (asyncRecord === currentAsyncRecord) {
2105+
// don't remove payload from where error originates
2106+
return true;
2107+
}
2108+
for (let i = 0; i < nullPathArray.length; i++) {
2109+
if (asyncRecord.path[i] !== nullPathArray[i]) {
2110+
// asyncRecord points to a path unaffected by this payload
2111+
return true;
2112+
}
2113+
}
2114+
2115+
return false;
2116+
});
2117+
}
2118+
20972119
function toIncrementalResult(
20982120
asyncPayloadRecord: AsyncPayloadRecord,
20992121
): IncrementalResult {
@@ -2123,28 +2145,6 @@ function toPayload(
21232145
return incremental.length ? { incremental, hasNext } : { hasNext };
21242146
}
21252147

2126-
function filterSubsequentPayloads(
2127-
exeContext: ExecutionContext,
2128-
nullPath: Path,
2129-
currentAsyncRecord: AsyncPayloadRecord | undefined,
2130-
): void {
2131-
const nullPathArray = pathToArray(nullPath);
2132-
exeContext.publisher.filter((asyncRecord) => {
2133-
if (asyncRecord === currentAsyncRecord) {
2134-
// don't remove payload from where error originates
2135-
return true;
2136-
}
2137-
for (let i = 0; i < nullPathArray.length; i++) {
2138-
if (asyncRecord.path[i] !== nullPathArray[i]) {
2139-
// asyncRecord points to a path unaffected by this payload
2140-
return true;
2141-
}
2142-
}
2143-
2144-
return false;
2145-
});
2146-
}
2147-
21482148
class DeferredFragmentRecord {
21492149
type: 'defer';
21502150
errors: Array<GraphQLError>;

0 commit comments

Comments
 (0)