graphql-network-inspector
graphql-network-inspector copied to clipboard
Show in progress queries/mutations
Is your feature request related to a problem? Please describe. Some queries/mutations can take a lot of time, i.e.: 30 seconds.
Describe the solution you'd like During that time, the request is going on, would be nice to see it as "In progress" or "Waiting for response" in the inspector.
Describe alternatives you've considered Usually I keep an eye on network tab for those requests but then I need to be aware they are taking too long and move between tabs.
Additional context N/A
Unfortunately this isn't possible. Chrome exposes no api to listen to the start of a request that we are able to associate to the end of a request.
I'm not familiar with the SDK for extensions but can't we simple render the loading, make the request and when it finishes render what needs to be rendered?
We only receive an event from the chrome api once the request has finished.
There is a way to get events when a request starts, which contains less information, but there is no way to associate the start event with the end event.
These events are:
Request Started: A few events that do expose a request starting https://developer.chrome.com/docs/extensions/reference/webRequest/
Request Finished: An onRequestFinished event which contains all network information https://developer.chrome.com/docs/extensions/reference/devtools_network/#event-onRequestFinished
If there were some fixed id
between the start and end events we could link the two. But as far as I can tell there is nothing concrete.
Can't we curry the callback function with the identifier somehow?
Again, I never worked on a Chrome Extension before, going through the docs here to see how it works but it might take me a while to figure.
Or even use a WeakMap with the request object (in the case it's the same object on both callbacks), I don't know yet.
Did you see that?
Request IDs Each request is identified by a request ID. This ID is unique within a browser session and the context of an extension. It remains constant during the life cycle of a request and can be used to match events for the same request. Note that several HTTP requests are mapped to one web request in case of HTTP redirection or HTTP authentication.
https://developer.chrome.com/docs/extensions/reference/webRequest/#request-ids
I think that's just in the context of all the events on the webRequest api. Whereas we are mixing webRequest and network.
This is being worked on currently.