Commit de4ae23 1 parent 5a57576 commit de4ae23 Copy full SHA for de4ae23
File tree 1 file changed +11
-0
lines changed
arduino-ide-extension/src/browser/boards
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 {
139
139
if ( selectedBoard && selectedBoard . fqbn ) {
140
140
const uninstalledBoard = event . item . boards . find ( ( { name } ) => name === selectedBoard . name ) ;
141
141
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
+ }
142
153
this . logger . info ( `Board package ${ event . item . id } was uninstalled. Discarding the FQBN of the currently selected ${ selectedBoard . name } board.` ) ;
143
154
const selectedBoardWithoutFqbn = {
144
155
name : selectedBoard . name
You can’t perform that action at this time.
0 commit comments