Skip to content

#573 Listen on the client's port change event #1545

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

Merged
merged 1 commit into from
Oct 17, 2022
Merged

#573 Listen on the client's port change event #1545

merged 1 commit into from
Oct 17, 2022

Conversation

kittaakos
Copy link
Contributor

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.

  • Attach boards,
  • Start IDE2,
  • Backend starts and detects the boards and ports via the board list -w gRPC equivalent, dispatches board/port change event but client is not started yet,
  • Client starts,
  • Initialize the dialog with zero ports (this is common practice to init with empty),
  • Listen on the backend board/port changes (event never arrives),
  • Attach/detach a board, and the ports section in the dialog starts working.

It was never an issue with the Tool > Port menu, as it was correctly listening on the client's events:

this.boardsServiceProvider.onAvailablePortsChanged(() =>
this.updateMenus()
);

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

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Oct 7, 2022
@kittaakos kittaakos requested review from AlbyIanna and per1234 October 7, 2022 12:52
Copy link
Contributor

@AlbyIanna AlbyIanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it and it works just fine. I've just left a little remark on the code, but to me it's already okay ✅

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not able to reproduce the fault so I can't verify that the change proposed here fixes it.

I don't experience any problems when using the build for this PR though.

If the board select dialog is listening on the backend's event,
the frontend might miss the event when it comes up, although boards
are connected and ports are discovered.

Closes #573

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent failure to recognize ports
3 participants