From 870c2b6d8b87bd9f7ec34d4d1b7a11e78f1d55a9 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Thu, 25 Jan 2018 14:03:13 +0000 Subject: [PATCH] Fixed deep copy bug with Fork/Register ingredient values. --- src/core/FlowControl.js | 6 ++++-- src/web/App.js | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/FlowControl.js b/src/core/FlowControl.js index cb63ce6c..fd2c0785 100755 --- a/src/core/FlowControl.js +++ b/src/core/FlowControl.js @@ -55,7 +55,9 @@ const FlowControl = { state.forkOffset += state.progress + 1; recipe.addOperations(subOpList); - const ingValues = subOpList.map(op => op.getIngValues()); + + // Take a deep(ish) copy of the ingredient values + const ingValues = subOpList.map(op => JSON.parse(JSON.stringify(op.getIngValues()))); // Run recipe over each tranche for (i = 0; i < inputs.length; i++) { @@ -63,7 +65,7 @@ const FlowControl = { // Baseline ing values for each tranche so that registers are reset subOpList.forEach((op, i) => { - op.setIngValues(ingValues[i]); + op.setIngValues(JSON.parse(JSON.stringify(ingValues[i]))); }); const dish = new Dish(inputs[i], inputType); diff --git a/src/web/App.js b/src/web/App.js index 38a578e8..64c9be3b 100755 --- a/src/web/App.js +++ b/src/web/App.js @@ -488,7 +488,6 @@ App.prototype.setRecipeConfig = function(recipeConfig) { // Unpause auto bake this.autoBakePause = false; - window.dispatchEvent(this.manager.statechange); };