Closed daveajrussell closed 2 months ago
Latest commit: d5003693520f0ae7929fb22aaca879f17d043d88
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This PR prototypes the concept of connection state.
I am introducing an
`EventEmitter
to schema poller class that consumers may subscribe to to be notified of connection events. Currently there are 2.. Connected and Reconnecting.. Connected is fired when a driver is initialized and passes auth/connectivity checks. Reconnecting is fired when a driver fails to pass auth and connectivity checks. I've gone with Reconnecting since the schema poller will retry every 30 seconds until it succeeds or the driver is closed.In the extension UI, when you connect to a connection you are first presented with a "Connecting" state.. the label next to the connection will briefly read
connecting...
until the Connected event fires and we can update state, at which point we switch the label toconnected
and show a success info message. For connections that are unhealthy we will show areconnecting...
label and an accompanying error message.This state will automatically update itself when the schema next polls.. i.e. if a connection becomes unhealthy, the UI will receive an update.
This approach introduces a fair amount of complexity, the flow state of the application becomes harder to follow and it becomes harder to test e2e.