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:
1 parent
9504a77458
commit
465a0cd535
1 file changed
+5
-1
@@ -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 () {
|
||||
|
||||
Reference in new issue
Block a user