From ac3e413cc669d7557a6ae3e992c66d6be6e0af21 Mon Sep 17 00:00:00 2001 From: Hari Krishna Date: Sat, 24 Feb 2024 11:20:10 +0000 Subject: [PATCH] fixed the issue with shared reference of the conditionValue object across components, causing changes made in one component to affect the other --- frontend/src/views/AngularWorkflow.jsx | 50 +++++++++++++++----------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 4ae83b79..2a093179 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -9500,8 +9500,9 @@ const AngularWorkflow = (defaultprops) => { { - tmpConditionValue.value = "equals"; - setTmpConditionValue(tmpConditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "equals"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"equals"} @@ -9511,8 +9512,9 @@ const AngularWorkflow = (defaultprops) => { { - tmpConditionValue.value = "does not equal"; - setTmpConditionValue(tmpConditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "does not equal"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"does not equal"} @@ -9522,8 +9524,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "startswith"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "startswith"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"starts with"} @@ -9533,8 +9536,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "endswith"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "endswith"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"ends with"} @@ -9544,8 +9548,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "contains"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "contains"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"contains"} @@ -9555,8 +9560,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "contains_any_of"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "contains_any_of"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"contains_any_of"} @@ -9566,8 +9572,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "matches regex"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "matches regex"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"matches regex"} @@ -9577,8 +9584,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "larger than"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "larger than"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"larger than"} @@ -9588,8 +9596,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "less than"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "less than"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"less than"} @@ -9599,8 +9608,9 @@ const AngularWorkflow = (defaultprops) => { { - conditionValue.value = "is empty"; - setConditionValue(conditionValue); + const newConditionValue = { ...conditionValue }; + newConditionValue.value = "is empty"; + setConditionValue(newConditionValue); setVariableAnchorEl(null); }} key={"is empty"}