#573 Listen on the client's port change event #1545
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Listen on the client's port changes to fix intermittent failure to recognize ports.
The problem was that the board select dialog was listening on the backend's board/port changes to show the available ports in the dialog. This was fundamentally incorrect as the following use case could happen.
board list -w
gRPC equivalent, dispatches board/port change event but client is not started yet,It was never an issue with the
Tool
>Port
menu, as it was correctly listening on the client's events:arduino-ide/arduino-ide-extension/src/browser/contributions/board-selection.ts
Lines 109 to 111 in bc264d1
With the proposed changes, the dialog is correctly listening on the client's board/port changes, so it cannot miss the event.
Change description
Other information
Closes #573
Locally, it was easy to reproduce the defect. Attach boards before starting IDE2. When IDE2 is up, open the board select dialog. Ports were empty. Now, it should work with the build from this PR.
Reviewer checklist