From 85aae55a270d6688a73c6fff7fa361c061b2e2ff Mon Sep 17 00:00:00 2001 From: Erlend Date: Wed, 29 Jun 2022 11:06:36 +0200 Subject: New choice can now be selected from the dropdown without leaving orphans --- .../src/app/pages/querybuilder/Components/Text/QueryDropDownForm.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'client') diff --git a/client/js/app/src/app/pages/querybuilder/Components/Text/QueryDropDownForm.jsx b/client/js/app/src/app/pages/querybuilder/Components/Text/QueryDropDownForm.jsx index 67b00faf242..cdcfe1d0408 100644 --- a/client/js/app/src/app/pages/querybuilder/Components/Text/QueryDropDownForm.jsx +++ b/client/js/app/src/app/pages/querybuilder/Components/Text/QueryDropDownForm.jsx @@ -28,11 +28,13 @@ export default function QueryDropdownForm({ choices, id, child = false }) { index = children.findIndex((element) => element.id === id); children[index].type = newType; children[index].hasChildren = childChoices[newType].hasChildren; + children[index].children = []; } else { const index = newInputs.findIndex((element) => element.id === id); newInputs[index].type = newType; let hasChildren = levelZeroParameters[newType].hasChildren; newInputs[index].hasChildren = hasChildren; + newInputs[index].children = []; } setInputs(newInputs); }; -- cgit v1.2.3