From d1090c6a45ab8755220051cc018bda7597af613a Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Sun, 14 Oct 2018 19:37:14 +0200 Subject: [PATCH] Fix files selection after dialog opening Feature #14232 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- .../inputs/file-array-input.tsx | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/views/run-process-panel/inputs/file-array-input.tsx b/src/views/run-process-panel/inputs/file-array-input.tsx index 391cc7fe81..be58eee212 100644 --- a/src/views/run-process-panel/inputs/file-array-input.tsx +++ b/src/views/run-process-panel/inputs/file-array-input.tsx @@ -138,14 +138,12 @@ const FileArrayInputComponent = connect(mapStateToProps)( this.setState({ files }); const ids = values(getProjectsTreePickerIds(this.props.commandInput.id)); - deletedFiles.forEach(({ id }) => { - ids.forEach(pickerId => { - this.props.dispatch( - treePickerActions.DESELECT_TREE_PICKER_NODE({ - pickerId, id, - }) - ); - }); + ids.forEach(pickerId => { + this.props.dispatch( + treePickerActions.DESELECT_TREE_PICKER_NODE({ + pickerId, id: deletedFiles.map(({ id }) => id), + }) + ); }); } @@ -159,19 +157,17 @@ const FileArrayInputComponent = connect(mapStateToProps)( : [...addedFiles, file] , []); - this.setState({ files }); - const ids = values(getProjectsTreePickerIds(this.props.commandInput.id)); - addedFiles.forEach(({ id }) => { - ids.forEach(pickerId => { - this.props.dispatch( - treePickerActions.SELECT_TREE_PICKER_NODE({ - pickerId, id, - }) - ); - }); + ids.forEach(pickerId => { + this.props.dispatch( + treePickerActions.SELECT_TREE_PICKER_NODE({ + pickerId, id: addedFiles.map(({ id }) => id), + }) + ); }); + this.setFiles(files); + } refreshFiles = () => { -- 2.30.2