Force new active index and value after hitting the remove button.

Fixes https://github.com/LLK/scratch-gui/issues/2361
This commit is contained in:
Paul Kaplan committed 2018-06-15 09:56:27 -04:00
1 parent 9504a77458
commit 465a0cd535
1 file changed
+5 -1
+5 -1
View File
@@ -107,7 +107,11 @@ class ListMonitor extends React.Component {
const newListValue = listValue.slice(0, this.state.activeIndex)
.concat(listValue.slice(this.state.activeIndex + 1));
setVariableValue(vm, targetId, variableId, newListValue);
this.handleActivate(Math.min(newListValue.length - 1, this.state.activeIndex));
const newActiveIndex = Math.min(newListValue.length - 1, this.state.activeIndex);
this.setState({
activeIndex: newActiveIndex,
activeValue: newListValue[newActiveIndex]
});
}
handleAdd () {