Repository navigation
Service extension buttons do not always respond to first click #8497
Description

Activity
- addedP2important to work on, but not at the top of the work list.important to work on, but not at the top of the work list.devtools-cross-screenIssues that affect multiple DevTools screens, i.e. shared functionality and widgetsIssues that affect multiple DevTools screens, i.e. shared functionality and widgets
on Oct 30, 2024 I looked into this today but wasn't able to get a fix, below are my learnings though:
- You can reproduce this consistently by minimizing the app you are debugging, all actions will take two clicks
- The issue is related to us not getting back messages from the vm service web socket until we send the second vm service request (on the second click), or the app is brought into the foreground.
- I was able to track this all the way back to the raw web socket, we do not get the event for the response at all, so we don't update the internal state, and the button does not toggle its state.
Ok, I did some more digging and tracked this down to the service extension implementation itself here.
That call to
_forceRepaint()waits forendOfFramebefore completing, andendOfFrameexplicitly documents that it can take a long time if the screen is off. I indeed confirmed endOfFrame doesn't complete until either something else calls_forceRepaint(which is why the 2nd click works), or the app is brought into the foreground.That does make the fix somewhat unclear - we could just not await this future inside the service extension as one option.
Or, we could show a spinner or something when you click the button, to indicate we are waiting for the response.
- added a commit that references this issue
on Feb 10, 2025