react-relay-network-modern icon indicating copy to clipboard operation
react-relay-network-modern copied to clipboard

Support for something like @defer?

Open zth opened this issue 7 years ago • 8 comments
trafficstars

Hi!

I was wondering if it would be possible to somehow support something like https://github.com/relay-tools/fetch-multipart-graphql in order to support the @defer directive. Would that change be too invasive on this code base, or would it be possible to implement in a sane way?

Thanks!

zth avatar Aug 22 '18 11:08 zth

Need to experiment with RelayResponse and its data property. Maybe if we put there Observable it will work. But for now, I have no free time for such experiments.

Needs to create createFromObservable method like it did with createFromGraphQL for ssr with graphql-js: https://github.com/relay-tools/react-relay-network-modern/blob/master/src/RelayResponse.js#L36

And try to set r.data equal to Observable.

If it will work, then need to write a 3rd party middleware like it did with https://github.com/relay-tools/react-relay-network-modern-ssr

Will glad to any help.

nodkz avatar Aug 25 '18 08:08 nodkz

Thank you for your reply! I'll have a look as soon as I find the time and get back to you with any findings/question.

zth avatar Aug 28 '18 19:08 zth

Bumping this now that @apollo/server can support the @defer directive, any work planned here?

alex-statsig avatar Sep 30 '22 17:09 alex-statsig

Bumping this now that @apollo/server can support the @defer directive, any work planned here?

It seems like just returning an Observable from beforeFetch works but the types aren't correct

alex-statsig avatar Oct 05 '22 05:10 alex-statsig

Any news on this? 👀

I got defer to work in the backend using apollo server. The relay network layer doesn't seam to parse the responses properly as it throws the error SyntaxError: No number after minus sign in JSON at position 3 (line 2 column 2).

a-tokyo avatar Jan 08 '24 12:01 a-tokyo