urql-graphql / urql-devtools

A tool for monitoring and debugging urql during development
https://formidable.com/open-source/urql/docs/advanced/debugging/#devtools
MIT License
255 stars 11 forks source link

Feature to list the used exchanges and inspect the states #396

Closed sharmapukar217 closed 2 years ago

sharmapukar217 commented 2 years ago

It will be very useful if the devtool has the features to get the exchanges used

andyrichardson commented 2 years ago

Hey @sharmapukar217 do you have an example of what you would use this for?

sharmapukar217 commented 2 years ago

the main is to know what exchanges am i using and how it is affecting the fetch flow. For example, inspect auth exchange to know the auth flow

andyrichardson commented 2 years ago

to know what exchanges am i using

I'm not too sure about this - exchanges are typically consistent so I'm struggling to see how devtools would provide more value than, for example, looking at the code to see what exchanges are passed to the client.

how it is affecting the fetch flow

This I can help you with! There's an API for dispatching events which any exchange can make use of to provide information about events (such as state changes).

Unfortunately, it looks like the auth exchange isn't making use of it.

It might be worth making an issue on this repo identifying some key events that users of the exchange might want to know about (tokenExpiry, tokenRefreshStart, tokenRefreshComplete, etc).

From there, you should be able to get a PR going to start dispatching them in the exchange 👍

sharmapukar217 commented 2 years ago

That would work for me