File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
arduino-ide-extension/src/browser/boards Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
139139 if ( selectedBoard && selectedBoard . fqbn ) {
140140 const uninstalledBoard = event . item . boards . find ( ( { name } ) => name === selectedBoard . name ) ;
141141 if ( uninstalledBoard && uninstalledBoard . fqbn === selectedBoard . fqbn ) {
142+ // We should not unset the FQBN, if the selected board is an attached, recognized board.
143+ // Attach Uno and install AVR, select Uno. Uninstall the AVR core while Uno is selected. We do not want to discard the FQBN of the Uno board.
144+ // Dev note: We cannot assume the `selectedBoard` is a type of `AvailableBoard`.
145+ // When the user selects an `AvailableBoard` it works, but between app start/stops,
146+ // it is just a FQBN, so we need to find the `selected` board among the `AvailableBoards`
147+ const selectedAvailableBoard = AvailableBoard . is ( selectedBoard )
148+ ? selectedBoard
149+ : this . _availableBoards . find ( availableBoard => Board . sameAs ( availableBoard , selectedBoard ) ) ;
150+ if ( selectedAvailableBoard && selectedAvailableBoard . selected && selectedAvailableBoard . state === AvailableBoard . State . recognized ) {
151+ return ;
152+ }
142153 this . logger . info ( `Board package ${ event . item . id } was uninstalled. Discarding the FQBN of the currently selected ${ selectedBoard . name } board.` ) ;
143154 const selectedBoardWithoutFqbn = {
144155 name : selectedBoard . name
You can’t perform that action at this time.
0 commit comments