@topconsultnpm/sdkui-react-beta 6.15.87 → 6.15.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,6 +32,7 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
32
32
|
const [isEditableList, addOrRemoveEditableList] = useMetadataEditableList();
|
|
33
33
|
const [selectedItem, setSelectedItem] = useState(undefined);
|
|
34
34
|
const [prevMetadataValues, setPrevMetadataValues] = useState([]);
|
|
35
|
+
const [inputMidsApplied, setInputMidsApplied] = useState(false);
|
|
35
36
|
const onChangeHandler = (newValue, mid) => {
|
|
36
37
|
let newValues = structuredClone(metadataValues);
|
|
37
38
|
const item = newValues.find(value => value.mid === mid);
|
|
@@ -93,12 +94,18 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
93
94
|
setDynDataListsToBeRefreshed(result);
|
|
94
95
|
});
|
|
95
96
|
}, [metadataValues, currentDTD]);
|
|
96
|
-
//
|
|
97
|
+
// Reset the inputMidsApplied flag when inputMids changes
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
setInputMidsApplied(false);
|
|
100
|
+
}, [inputMids]);
|
|
101
|
+
// Process inputMids to set values for specific metadata items (only once)
|
|
97
102
|
useEffect(() => {
|
|
98
103
|
if (!inputMids || inputMids.length === 0)
|
|
99
104
|
return;
|
|
100
105
|
if (!metadataValues || metadataValues.length === 0)
|
|
101
106
|
return;
|
|
107
|
+
if (inputMidsApplied)
|
|
108
|
+
return; // Don't apply again if already applied
|
|
102
109
|
// Clone the current metadata values
|
|
103
110
|
let newValues = structuredClone(metadataValues);
|
|
104
111
|
let hasChanges = false;
|
|
@@ -116,8 +123,9 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
|
|
|
116
123
|
// Call onValueChanged once with all changes
|
|
117
124
|
if (hasChanges) {
|
|
118
125
|
onValueChanged?.(newValues);
|
|
126
|
+
setInputMidsApplied(true); // Mark as applied
|
|
119
127
|
}
|
|
120
|
-
}, [inputMids, metadataValues]); //
|
|
128
|
+
}, [inputMids, metadataValues, inputMidsApplied]); // Keep metadataValues but add safety check
|
|
121
129
|
const loadDynDataListToBeRefreshedCascadeAsync = async (tid, mvdList) => {
|
|
122
130
|
if (!tid)
|
|
123
131
|
return [];
|