Skip to content
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

feat: allow setting a new execution result via the onResultProcessHook #1503

Closed
wants to merge 1 commit into from

Conversation

n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented Jul 29, 2022

From #graphql-yoga discord:

[01:20] marais: how do we set a custom pattern for responses?
[01:20] marais: as in, i dont want yoga to always create json responses, i need it to be multipart of defer/stream

This currently requires adding a setResult API within the experimental onResultProcess hook. (EDIT: see comment below.)
We can make this more straight-forward to use in v3

@n1ru4l n1ru4l requested a review from ardatan July 29, 2022 10:00
@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2022

🦋 Changeset detected

Latest commit: 2aa2b87

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@graphql-yoga/common Minor
@graphql-yoga/node Minor
@graphql-yoga/render-graphiql Major
cloudflare-advanced Patch
cloudflare Patch
service-worker Patch
sveltekit Patch
apollo-federation-gateway-with-yoga Patch
apollo-subgraph-with-yoga Patch
graphql-lambda Patch
defer-stream-example Patch
error-masking-example Patch
express-example Patch
fastify-modules-example Patch
fastify-example Patch
file-upload-nextjs-pothos Patch
file-upload-nexus Patch
file-upload Patch
example-generic-auth Patch
graphql-ws Patch
hackernews Patch
hello-world Patch
koa-example Patch
example-live-query Patch
nextjs-auth Patch
nextjs Patch
node-esm Patch
example-redis-pub-sub Patch
subscriptions-example Patch
hello-world-benchmark Patch

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

@n1ru4l n1ru4l force-pushed the feat-set-execution-result branch from f95399c to 2aa2b87 Compare July 29, 2022 10:03
@github-actions
Copy link
Contributor

The latest changes of this PR are not available as canary, since there are no linked changesets for this PR.

@n1ru4l
Copy link
Collaborator Author

n1ru4l commented Jul 29, 2022

Edit: I just noticed that the result can already be "overwritten" within onExecute.onExecuteDone

See https://codesandbox.io/s/yoga-enforce-specific-protocol-64p8h8?file=/README.md

@ardatan What do you think should we still allow overwriting it within onResultProcessHook?

@n1ru4l
Copy link
Collaborator Author

n1ru4l commented Aug 1, 2022

Closing as this can already be done via https://codesandbox.io/s/yoga-enforce-specific-protocol-64p8h8?file=/README.md

@n1ru4l n1ru4l closed this Aug 1, 2022
@n1ru4l n1ru4l deleted the feat-set-execution-result branch August 1, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant