Skip to content

Commit 5cf2cb2

Browse files
authored
Merge pull request scratchfoundation#2363 from paulkaplan/fix-list-monitor-remove
Force new active index and value after hitting the remove button.
2 parents 41db3e2 + 465a0cd commit 5cf2cb2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/containers/list-monitor.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ class ListMonitor extends React.Component {
107107
const newListValue = listValue.slice(0, this.state.activeIndex)
108108
.concat(listValue.slice(this.state.activeIndex + 1));
109109
setVariableValue(vm, targetId, variableId, newListValue);
110-
this.handleActivate(Math.min(newListValue.length - 1, this.state.activeIndex));
110+
const newActiveIndex = Math.min(newListValue.length - 1, this.state.activeIndex);
111+
this.setState({
112+
activeIndex: newActiveIndex,
113+
activeValue: newListValue[newActiveIndex]
114+
});
111115
}
112116

113117
handleAdd () {

0 commit comments

Comments
 (0)