graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Support @defer and @stream in operations plugin

Open n1ru4l opened this issue 2 years ago • 1 comments

defer and stream are close to land and should be correctly supported within the code output.

n1ru4l avatar May 25 '22 18:05 n1ru4l

Is there a theory of roughly what sorts of types should be generated for incremental delivery operations?

glasser avatar Aug 16 '22 00:08 glasser

@hwillson 😍 any way to support you on this?

@glasser for @defer at least it's pretty basic, the deferred fields need to be made optional and that's all. Per the apollo documentation:

Our deferred fields will not exist as keys on data yet [...]

https://www.apollographql.com/docs/react/data/defer/

marcesengel avatar Feb 02 '23 15:02 marcesengel

+1 to the previous question — @hwillson, do you think you're gonna continue working on adding defer support and is there any way to help you?

beerose avatar Mar 13 '23 11:03 beerose

Is defer supported now? Looking at the PR referenced and this example https://github.com/dotansimha/graphql-code-generator/tree/master/examples/react/apollo-client-defer.

alesso-x avatar May 16 '23 17:05 alesso-x

Yes, we will release it today 😇

n1ru4l avatar May 24 '23 08:05 n1ru4l

@n1ru4l I am still unable to use the defer directive with the latest version of graphql-codegen. I see the event streams coming in but I think Apollo is having an issue parsing the data that is returned.

Screenshot 2024-05-16 2 50 35 PM Screenshot 2024-05-16 2 50 31 PM

This is the error:

ServerParseError: Network Error: Please try again
    at JSON.parse (<anonymous>)
    at parseJsonBody (webpack-internal:///../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:134:21)
    at eval (webpack-internal:///../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js:167:48)

jennyk1 avatar May 16 '24 21:05 jennyk1

Hi there @jennyk1 👋 I work on Apollo Client and it looks like your server is using SSE to communicate with the client which isn't supported out of the box.

Can you please open an issue over on the Apollo Client repository since this issue doesn't have to do with codegen? Thanks!

alessbell avatar May 16 '24 22:05 alessbell