8000 fix: board `<select>` update on board detach by kittaakos · Pull Request #2291 · arduino/arduino-ide · GitHub
[go: up one dir, main page]

Skip to content

fix: board <select> update on board detach #2291

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
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: board <select> update on board detach
When the previously selected board is not detected, unset the `<select>`
option.

Closes #2222

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
  • Loading branch information
10000
Akos Kitta committed Nov 22, 2023
commit e1dd588eb774659ad5fb547a80801c13f15f26c0
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const CertificateUploaderComponent = ({
const onItemSelect = React.useCallback(
(item: BoardOptionValue | null) => {
if (!item) {
setSelectedItem(null);
return;
}
const board = item.board;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { nls } from '@theia/core/lib/common';
import React from '@theia/core/shared/react';
import type {
BoardList,
BoardListItemWithBoard,
import {
boardListItemEquals,
type BoardList,
type BoardListItemWithBoard,
} from '../../../common/protocol/board-list';
import { ArduinoSelect } from '../../widgets/arduino-select';

Expand Down Expand Up @@ -75,7 +76,9 @@ export const SelectBoardComponent = ({
setSelectOptions(boardOptions);

if (selectedItem) {
selBoard = updatableBoards.indexOf(selectedItem);
selBoard = updatableBoards.findIndex((board) =>
boardListItemEquals(board, selectedItem)
);
}

selectOption(boardOptions[selBoard] || null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const FirmwareUploaderComponent = ({
const onItemSelect = React.useCallback(
(item: BoardListItemWithBoard | null) => {
if (!item) {
setSelectedItem(null);
return;
}
const board = item.board;
Expand Down
0