@@ -21,21 +21,22 @@ import Split from "split.js";
21
21
* @param {Object } options - Default setting for app options.
22
22
*/
23
23
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 ;
39
40
} ;
40
41
41
42
@@ -166,7 +167,7 @@ App.prototype.bake = async function(step) {
166
167
* Runs Auto Bake if it is set.
167
168
*/
168
169
App . prototype . autoBake = function ( ) {
169
- if ( this . autoBake_ ) {
170
+ if ( this . autoBake_ && ! this . autoBakePause ) {
170
171
this . bake ( ) ;
171
172
}
172
173
} ;
@@ -413,9 +414,9 @@ App.prototype.loadURIParams = function() {
413
414
return b ;
414
415
} ) ( window . location . search . substr ( 1 ) . split ( "&" ) ) ;
415
416
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 ;
419
420
420
421
// Read in recipe from query string
421
422
if ( this . queryString . recipe ) {
@@ -451,8 +452,8 @@ App.prototype.loadURIParams = function() {
451
452
} catch ( err ) { }
452
453
}
453
454
454
- // Restore auto-bake state
455
- this . autoBake_ = autoBakeVal ;
455
+ // Unpause auto-bake
456
+ this . autoBakePause = false ;
456
457
this . autoBake ( ) ;
457
458
} ;
458
459
0 commit comments