Skip to content

Commit

Permalink
Introduces new incremental response format (#3886)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yaacovCR authored Aug 24, 2023
1 parent 75d419d commit 00e2b50
Show file tree
Hide file tree
Showing 9 changed files with 1,568 additions and 830 deletions.
499 changes: 353 additions & 146 deletions src/execution/IncrementalPublisher.ts

Large diffs are not rendered by default.

485 changes: 213 additions & 272 deletions src/execution/__tests__/defer-test.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/execution/__tests__/mutations-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ describe('Execute: Handles mutation execution ordering', () => {
{
incremental: [
{
label: 'defer-label',
path: ['first'],
data: {
promiseToGetTheNumber: 2,
},
},
],
completed: [{ path: ['first'], label: 'defer-label' }],
hasNext: false,
},
]);
Expand Down Expand Up @@ -317,7 +317,6 @@ describe('Execute: Handles mutation execution ordering', () => {
{
incremental: [
{
label: 'defer-label',
path: [],
data: {
first: {
Expand All @@ -326,6 +325,7 @@ describe('Execute: Handles mutation execution ordering', () => {
},
},
],
completed: [{ path: [], label: 'defer-label' }],
hasNext: false,
},
]);
Expand Down
Loading

0 comments on commit 00e2b50

Please sign in to comment.