Skip to content

Commit 98f67fc

Browse files
committed
use the source data used to check the diffs
1 parent 431d72d commit 98f67fc

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

services/static-webserver/client/source/class/osparc/data/model/Study.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,14 +699,12 @@ qx.Class.define("osparc.data.model.Study", {
699699
/**
700700
* Call patch Study, but the changes were already applied on the frontend
701701
* @param studyDiffs {Object} Diff Object coming from the JsonDiffPatch lib. Use only the keys, not the changes.
702-
* @param sourceStudy {Object} Study object that was used to apply the diffs on the frontend.
702+
* @param studySource {Object} Study object that was used to check the diffs on the frontend.
703703
*/
704-
patchStudyDelayed: function(studyDiffs, sourceStudy) {
704+
patchStudyDelayed: function(studyDiffs, studySource) {
705705
const promises = [];
706-
let workbenchDiffs = {};
707706
if ("workbench" in studyDiffs) {
708-
workbenchDiffs = studyDiffs["workbench"];
709-
promises.push(this.getWorkbench().patchWorkbenchDelayed(workbenchDiffs));
707+
promises.push(this.getWorkbench().patchWorkbenchDelayed(studyDiffs["workbench"], studySource["workbench"]));
710708
delete studyDiffs["workbench"];
711709
}
712710
const fieldKeys = Object.keys(studyDiffs);
@@ -731,7 +729,7 @@ qx.Class.define("osparc.data.model.Study", {
731729
}
732730
return Promise.all(promises)
733731
.then(() => {
734-
return sourceStudy;
732+
return studySource;
735733
});
736734
}
737735
}

services/static-webserver/client/source/class/osparc/data/model/Workbench.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,9 @@ qx.Class.define("osparc.data.model.Workbench", {
784784
/**
785785
* Call patch Node, but the changes were already applied on the frontend
786786
* @param workbenchDiffs {Object} Diff Object coming from the JsonDiffPatch lib. Use only the keys, not the changes.
787+
* @param workbenchSource {Object} Workbench object that was used to check the diffs on the frontend.
787788
*/
788-
patchWorkbenchDelayed: function(workbenchDiffs) {
789+
patchWorkbenchDelayed: function(workbenchDiffs, workbenchSource) {
789790
const promises = [];
790791
Object.keys(workbenchDiffs).forEach(nodeId => {
791792
const node = this.getNode(nodeId);
@@ -794,11 +795,11 @@ qx.Class.define("osparc.data.model.Workbench", {
794795
return;
795796
}
796797

797-
const nodeData = node.serialize();
798+
// use the source data used to check the diffs
799+
const nodeData = workbenchSource[nodeId];
798800
let patchData = {};
799801
if (workbenchDiffs[nodeId] instanceof Array) {
800-
// if workbenchDiffs is an array means that the node was either added or removed
801-
// the node was added
802+
// if workbenchDiffs is an array means that the node was added
802803
patchData = nodeData;
803804
} else {
804805
// patch only what was changed

0 commit comments

Comments
 (0)