From a4c23e019f72ab6def5c57c0d2ffbcf99d46fe3f Mon Sep 17 00:00:00 2001 From: Kirill Shumilov Date: Tue, 26 Mar 2019 18:53:36 +0300 Subject: [PATCH] fix(xod-client-electron): fix default board index value and force setting of board index as integer --- .../src/upload/components/PopupUploadConfig.jsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/xod-client-electron/src/upload/components/PopupUploadConfig.jsx b/packages/xod-client-electron/src/upload/components/PopupUploadConfig.jsx index 3849022a4..787a52896 100644 --- a/packages/xod-client-electron/src/upload/components/PopupUploadConfig.jsx +++ b/packages/xod-client-electron/src/upload/components/PopupUploadConfig.jsx @@ -43,7 +43,7 @@ class PopupUploadConfig extends React.Component { } onBoardChanged(event) { - this.changeBoard(event.target.value); + this.changeBoard(parseInt(event.target.value, 10) || 0); } onUploadClicked() { @@ -94,8 +94,15 @@ class PopupUploadConfig extends React.Component { isBoardSelected && boards[selectedBoard.index]; const defaultBoardIndex = R.compose( - R.defaultTo(0), - R.findIndex(R.propEq('fqbn', 'arduino:avr:uno')) + R.when(R.equals(-1), R.always(0)), + R.findIndex( + R.either( + // If arduino:avr is not installed yet: + R.propEq('name', 'Arduino/Genuino Uno'), + // If it already installed: + R.propEq('fqbn', 'arduino:avr:uno') + ) + ) )(boards); if (!isBoardSelected || !doesSelectedBoardExist) {