Skip to content

Commit 00e2b50

Browse files
authored
Introduces new incremental response format (#3886)
The `incremental` array is the actual data to be applied to the response, while the `completed` array return "metadata" about the execution, used to inform clients that defers are being executed and when all fields for that defer have been delivered. To ensure consistency, clients are expected to process all objects in the `incremental` array for a given payload before re-rendering the associated UIs. See graphql/defer-stream-wg#69 for full details.
1 parent 75d419d commit 00e2b50

File tree

9 files changed

+1568
-830
lines changed

9 files changed

+1568
-830
lines changed

src/execution/IncrementalPublisher.ts

Lines changed: 353 additions & 146 deletions
Large diffs are not rendered by default.

src/execution/__tests__/defer-test.ts

Lines changed: 213 additions & 272 deletions
Large diffs are not rendered by default.

src/execution/__tests__/mutations-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,13 @@ describe('Execute: Handles mutation execution ordering', () => {
242242
{
243243
incremental: [
244244
{
245-
label: 'defer-label',
246245
path: ['first'],
247246
data: {
248247
promiseToGetTheNumber: 2,
249248
},
250249
},
251250
],
251+
completed: [{ path: ['first'], label: 'defer-label' }],
252252
hasNext: false,
253253
},
254254
]);
@@ -317,7 +317,6 @@ describe('Execute: Handles mutation execution ordering', () => {
317317
{
318318
incremental: [
319319
{
320-
label: 'defer-label',
321320
path: [],
322321
data: {
323322
first: {
@@ -326,6 +325,7 @@ describe('Execute: Handles mutation execution ordering', () => {
326325
},
327326
},
328327
],
328+
completed: [{ path: [], label: 'defer-label' }],
329329
hasNext: false,
330330
},
331331
]);

0 commit comments

Comments
 (0)