-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement correct merging of incremental respones (@defer/@stream) #3580
Conversation
🦋 Changeset detectedLatest commit: 8acbecf The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Neat! Something I've been wondering... The new response format has each payload containing supplemental data/items, but also metadata about the incremental stream in the form of pending/completed notifications. With the UI strategy of merging incremental data into the initial response, that information is not currently shown. It also makes it impossible to tell from the final result what actually happened; the user has to watch carefully as the process unfolds. Might we want to model display of incremental results similar to subscriptions in which we just display the different payloads separately. Maybe as a toggle-able separate useful option? |
I've been pondering about that as well. GraphiQL currently has no good interface for long-running requests that return more than one payload.
This would need some bigger re-architecting for how the internal state is managed as well as the UI. I see that as outside of the scope of this PR which is just intending to fix the most pressing issues with defer/stream. |
Oh => I suppose I am simply mistaken about subscriptions. Sorry about that! |
yes this UI change to results for subscriptions has been something we've been hoping to execute for a while. And incremental delivery with stream creates another UI case, where we want to see the final result but also a log of the requests that formed that result. We hope to expose plugins for custom tabs in results, and to allow overriding the results pane, and the other idea we had years ago was for these results plugins could register and display for specific response types automatically. |
@thomasheyenbrock looks awesome! just need to fix this ts bug:
and get the unit and related cypress tests passing. if you like, i can show you how to enable to e2e tests for defer and stream, if this has been merged into |
a4b01ba
to
c52b5d3
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3580 +/- ##
==========================================
- Coverage 55.33% 55.31% -0.03%
==========================================
Files 115 115
Lines 5349 5351 +2
Branches 1450 1451 +1
==========================================
Hits 2960 2960
- Misses 1963 1965 +2
Partials 426 426
|
The latest changes of this PR are available as canary in npm (based on the declared
|
Fixed the TS and linter issues 👍 (sorry for taking so long to come back to this). Will have another look at e2e tests tomorrow. The current ones are passing but I also remember that we had some for defer/stream, so worth a look. |
@thomasheyenbrock awesome! yes the e2e tags are designed to reference the |
Yes, just found the same thing 👍 will merge this for now and look into testing defer/stream reliably a bit more in detail separately |
Hello fellow GraphiQL friends 👋
We recently stumbled over the fact that GraphiQL does not yet implement the latest incremental response format for defer/stream, concretely the
incremental
payload property is not handled.This PR cleans up the merge logic and makes it work for any incremental response payload. (Big inspiration taken from
graphql-tools/utils
, but if felt overkill to add the whole package just for this one utility, and since this is the official reference implementation for a GraphQL IDE it felt appropriate to have that utility as first-class citizen in our code.)Some before-after illustrations: