-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push events from the client instead of polling for them #1379
Conversation
#441 Bundle Size — 1.26MiB (~-0.01%).Warning Bundle contains 12 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch jerel/push-client-events Project dashboard |
5b0bdd0
to
743ac9b
Compare
@@ -15,7 +15,7 @@ panelWindow.on("initializePanel", (message) => { | |||
panelWindow.on("devtoolsStateChanged", (message) => { | |||
devtoolsState(message.state); | |||
|
|||
if (message.state === "connected") { | |||
if (message.state !== "connected") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit of code was kept around from some legacy behavior (pre-actor/rpc days) where it would keep around the old data on screen until the another client connected, then it would reset it and use the new data.
This actually caused a bug in the change from this PR due to the sequence of events where we'd initialize the panel with data already in the client, but because this was cleared on the connected event, it would show no data.
I always thought this behavior was a bit strange anyways since it sorta made it seem like the devtools were still connected in some way to the old client. Instead, this will now reset all data if the client is no longer connected.
ce0b6af
to
98c0d5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read the code and tested it - this is amazing! :)
90d4720
to
ffc44d4
Compare
Going to push out the other two changes, then will get to this next week. Spacing them will ensure the other release doesn't break anything. |
c9dd801
to
1441df6
Compare
This reverts commit eacfbef.
Reintroduces the
__actionHookForDevtools
hook which allows us to push updates from the client to the devtools. This removes the need for polling from the devtools for updates continuously.As a result, the polling code is (mostly) gone except for the handling of one edge case where queries kicked off right after the client is registered are not reported via the action hook. We will poll for a brief time until we know the client starts pushing data again or it disconnects.
This change has the benefit that changes from the client are reflected immediately in the devtools UI rather than waiting for the next tick of the poll interval so it feels a bit snappier.
To test this, try a few different situations: