Changed props getter to clone recursively instead of freezing

This commit is contained in:
Alexander Cerutti
2021-10-20 21:28:01 +02:00
parent 57f8fc5be3
commit e0c6d61c30
2 changed files with 6 additions and 6 deletions

View File

@@ -81,7 +81,7 @@ export function removeHidden(from: Array<string>): Array<string> {
* @returns
*/
export function freezeRecursive(object: Object) {
export function cloneRecursive(object: Object) {
const objectCopy = {};
const objectEntries = Object.entries(object);
@@ -93,15 +93,15 @@ export function freezeRecursive(object: Object) {
objectCopy[key] = value.slice();
for (let j = 0; j < value.length; j++) {
objectCopy[key][j] = freezeRecursive(value[j]);
objectCopy[key][j] = cloneRecursive(value[j]);
}
} else {
objectCopy[key] = freezeRecursive(value);
objectCopy[key] = cloneRecursive(value);
}
} else {
objectCopy[key] = value;
}
}
return Object.freeze(objectCopy);
return objectCopy;
}