From f4b31c736aac4a009940a034a7358cfdcc6f5f74 Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Wed, 18 Aug 2021 16:50:42 +0200 Subject: [PATCH] fix diff proxy making properties inaccessible when properties on the same object where changed --- js/diff.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/diff.js b/js/diff.js index b5c00efc77c..98319c21891 100644 --- a/js/diff.js +++ b/js/diff.js @@ -2,6 +2,8 @@ * The diff proxy records all changes to the original object without changing the original object while emulating the * changes for access from outside. The resulting diff object can then be applied on the original. The resulting object * is the same as if the changes were applied directly to the original object. + * + * NOTE: When doing any changes to this, rerun the tests cases at devNotes/tests. */ App.Utils.Diff = (function() { const deletedSymbol = Symbol("deleted property"); @@ -64,7 +66,8 @@ App.Utils.Diff = (function() { // Deep copy in case array entries get modified later localDiff[key] = _.cloneDeep(original); } else if (_.isObject(original)) { - localDiff[key] = {}; + // TODO check if there is a way to keep the data structure valid without the need for deep clone + localDiff[key] = _.cloneDeep(original); } } localDiff = localDiff[key]; -- GitLab