Skip to content

Commit e7f5b17

Browse files
committed
Manual bake now triggers when recipes are loaded from the URL. Fixes #93.
1 parent 69e12b1 commit e7f5b17

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/web/App.js

+22-21
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,22 @@ import Split from "split.js";
2121
* @param {Object} options - Default setting for app options.
2222
*/
2323
const App = function(categories, operations, defaultFavourites, defaultOptions) {
24-
this.categories = categories;
25-
this.operations = operations;
26-
this.dfavourites = defaultFavourites;
27-
this.doptions = defaultOptions;
28-
this.options = Utils.extend({}, defaultOptions);
29-
30-
this.chef = new Chef();
31-
this.manager = new Manager(this);
32-
33-
this.baking = false;
34-
this.autoBake_ = false;
35-
this.progress = 0;
36-
this.ingId = 0;
37-
38-
window.chef = this.chef;
24+
this.categories = categories;
25+
this.operations = operations;
26+
this.dfavourites = defaultFavourites;
27+
this.doptions = defaultOptions;
28+
this.options = Utils.extend({}, defaultOptions);
29+
30+
this.chef = new Chef();
31+
this.manager = new Manager(this);
32+
33+
this.baking = false;
34+
this.autoBake_ = false;
35+
this.autoBakePause = false;
36+
this.progress = 0;
37+
this.ingId = 0;
38+
39+
window.chef = this.chef;
3940
};
4041

4142

@@ -166,7 +167,7 @@ App.prototype.bake = async function(step) {
166167
* Runs Auto Bake if it is set.
167168
*/
168169
App.prototype.autoBake = function() {
169-
if (this.autoBake_) {
170+
if (this.autoBake_ && !this.autoBakePause) {
170171
this.bake();
171172
}
172173
};
@@ -413,9 +414,9 @@ App.prototype.loadURIParams = function() {
413414
return b;
414415
})(window.location.search.substr(1).split("&"));
415416

416-
// Turn off auto-bake while loading
417-
const autoBakeVal = this.autoBake_;
418-
this.autoBake_ = false;
417+
// Pause auto-bake while loading but don't modify `this.autoBake_`
418+
// otherwise `manualBake` cannot trigger.
419+
this.autoBakePause = true;
419420

420421
// Read in recipe from query string
421422
if (this.queryString.recipe) {
@@ -451,8 +452,8 @@ App.prototype.loadURIParams = function() {
451452
} catch (err) {}
452453
}
453454

454-
// Restore auto-bake state
455-
this.autoBake_ = autoBakeVal;
455+
// Unpause auto-bake
456+
this.autoBakePause = false;
456457
this.autoBake();
457458
};
458459

src/web/RecipeWaiter.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ RecipeWaiter.prototype.buildRecipeOperation = function(el) {
354354
el.classList.add("flow-control-op");
355355
}
356356

357-
// Disable auto-bake if this is a manual op - this should be moved to the 'operationadd'
358-
// handler after event restructuring
357+
// Disable auto-bake if this is a manual op
359358
if (op.manualBake && this.app.autoBake_) {
360359
this.manager.controls.setAutoBake(false);
361360
this.app.alert("Auto-Bake is disabled by default when using this operation.", "info", 5000);

0 commit comments

Comments
 (0)