From 465a0cd535bb8db54a80e1d8e20d1dd53efb5f97 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Fri, 15 Jun 2018 09:56:27 -0400 Subject: [PATCH] Force new active index and value after hitting the remove button. Fixes https://github.com/LLK/scratch-gui/issues/2361 --- src/containers/list-monitor.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/containers/list-monitor.jsx b/src/containers/list-monitor.jsx index c4b40584e..f20fd6148 100644 --- a/src/containers/list-monitor.jsx +++ b/src/containers/list-monitor.jsx @@ -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 () {