From b5917515d25febb1fd92fb266affe559a2184c17 Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Tue, 30 Mar 2021 15:49:03 +0200 Subject: [PATCH] fix: delete strategy (#262) --- .../feature/strategy/strategies-list-component.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/feature/strategy/strategies-list-component.jsx b/frontend/src/component/feature/strategy/strategies-list-component.jsx index cc49269a47..c7379b1697 100644 --- a/frontend/src/component/feature/strategy/strategies-list-component.jsx +++ b/frontend/src/component/feature/strategy/strategies-list-component.jsx @@ -82,8 +82,14 @@ const StrategiesList = props => { setDelStrategy(index); }; - const removeStrategy = () => { + const removeStrategy = async () => { + const strategy = editableStrategies[delStrategy]; + + if (!strategy.new) { + await props.saveStrategies(props.configuredStrategies.filter((_, i) => i !== delStrategy)); + } updateEditableStrategies(editableStrategies.filter((_, i) => i !== delStrategy)); + setDelStrategy(undefined); setShowDelDialog(null); };