mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-04-19 12:57:17 +00:00
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>
This commit is contained in:
parent
d01f95647e
commit
0ca1a31747
@ -69,6 +69,7 @@ export const CertificateUploaderComponent = ({
|
||||
const onItemSelect = React.useCallback(
|
||||
(item: BoardOptionValue | null) => {
|
||||
if (!item) {
|
||||
setSelectedItem(null);
|
||||
return;
|
||||
}
|
||||
const board = item.board;
|
||||
|
@ -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';
|
||||
|
||||
@ -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);
|
||||
|
@ -104,6 +104,7 @@ export const FirmwareUploaderComponent = ({
|
||||
const onItemSelect = React.useCallback(
|
||||
(item: BoardListItemWithBoard | null) => {
|
||||
if (!item) {
|
||||
setSelectedItem(null);
|
||||
return;
|
||||
}
|
||||
const board = item.board;
|
||||
|
Loading…
x
Reference in New Issue
Block a user