warrenday / graphql-network-inspector

A better network inspector for viewing and debugging GraphQL requests.
MIT License
466 stars 46 forks source link

Support defer directives #110

Open LouisIV opened 11 months ago

LouisIV commented 11 months ago

Is your feature request related to a problem? Please describe. Currently the extension doesn't support @defer directives. wg-doc. These are supported by the Apollo suite of tools.

Essentially they send multiple payloads using multipart form data. They look like the following when the client has the defer support active but not in use (when the @defer directive isn't used in the query):

--graphql
content-type: application/json

{"data":{"me":{"__typename":"User","role":"ADMIN","username":"-","createdAt":"2023-03-20T21:57:49.466Z","updatedAt":"2023-07-27T15:41:06.231Z"}}}
--graphql--

There is more information in the working group doc about multi part responses.

Describe the solution you'd like I'd really hope that at least in the first iteration queries using this multipart system are supported. Not necessarily the ones using @defer. Currently all entries in the extension just show empty responses whenever this spec is enabled.

Describe alternatives you've considered The apollo graphql extension and Urql extensions support this spec but they require you to modify your application bundle and aren't nearly as cool as this extension.

Additional context

image image

I'm willing to work on this a bit but it requires re-writing a lot of the multipart support logic so I'd like some input from the maintainers on how they'd like that to be re-structured before I dive into it.

warrenday commented 11 months ago

Hey @LouisIV

Thanks for raising the issue. We haven't added any support for defer directives.

The multipart code is fairly new, I've got no issue with you rewriting the logic.

If you want to go ahead with a PR that would be great.

I'm here to support with any queries on the codebase or anything else in general.