drf-react-by-schema 0.15.1 → 0.15.2
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.
|
@@ -195,7 +195,12 @@ function APIWrapper({ handleLoading, setSnackBar, setDialog, children }) {
|
|
|
195
195
|
});
|
|
196
196
|
if (setValue && getValues) {
|
|
197
197
|
const targetKey = fieldKey && index >= 0 ? `${fieldKey}.${index}.${model}` : model;
|
|
198
|
-
const
|
|
198
|
+
const value = getValues(targetKey);
|
|
199
|
+
const newValue = Array.isArray(value)
|
|
200
|
+
? value.map((item) => {
|
|
201
|
+
return item.id === data.id ? data : item;
|
|
202
|
+
})
|
|
203
|
+
: Object.assign(Object.assign(Object.assign({}, value), data), { label: data[labelKey] });
|
|
199
204
|
setValue(targetKey, newValue);
|
|
200
205
|
populateOptionsAC([model]);
|
|
201
206
|
}
|
package/package.json
CHANGED