Remove unnecessary sanitization of drag and drop result

[MAILPOET-2610]
This commit is contained in:
Rostislav Wolny
2020-01-27 12:37:49 +01:00
committed by Jack Kitterhing
parent 356ffbf3fe
commit 4fd6f96f76

View File

@@ -66,18 +66,10 @@ const Preview = ({
return null;
}
// Remove unwanted properties added by sortable
const sanitizeValue = (value) => {
const sanitized = { ...value };
delete sanitized.chosen;
delete sanitized.selected;
return sanitized;
};
const onUpdate = (valueId, text) => {
const value = valuesWhileMoved.find((v) => v.id === valueId);
value.name = text;
update(sanitizeValue(value));
update(value);
};
const onCheck = (valueId, checked) => {
@@ -86,13 +78,13 @@ const Preview = ({
const checkedValue = valuesWhileMoved.find((v) => v.isChecked);
if (checkedValue) {
delete checkedValue.isChecked;
update(sanitizeValue(checkedValue));
update(checkedValue);
}
value.isChecked = true;
} else {
delete value.isChecked;
}
update(sanitizeValue(value));
update(value);
};
const onDragEnd = (result) => {