@@ -116,8 +116,6 @@ export class Overmind<Config extends Configuration> implements Configuration {
116116 }
117117 }
118118
119- this . initializeReactions ( configuration , eventHub , proxyStateTree )
120-
121119 eventHub . on ( EventType . OPERATOR_ASYNC , ( data ) => {
122120 const flushData = proxyStateTree . flush ( true )
123121 if ( this . devtools && flushData . mutations . length ) {
@@ -279,7 +277,7 @@ export class Overmind<Config extends Configuration> implements Configuration {
279277 setTimeout ( ( ) => {
280278 scopedTree . clearMutationTracking ( )
281279 const flushData = scopedTree . flush ( true )
282- if ( flushData . mutations . length ) {
280+ if ( this . devtools && flushData . mutations . length ) {
283281 this . devtools . send ( {
284282 type : 'flush' ,
285283 data : {
@@ -343,34 +341,6 @@ export class Overmind<Config extends Configuration> implements Configuration {
343341 } )
344342 this . devtools = devtools
345343 }
346- private initializeReactions ( configuration , eventHub , proxyStateTree ) {
347- const reactions = Object . keys ( configuration . reactions || { } ) . reduce (
348- ( aggr , name ) => {
349- if ( typeof configuration . reactions [ name ] === 'function' ) {
350- return Object . assign ( aggr , {
351- [ name ] : configuration . reactions [ name ] ( ( stateCb , action ) => {
352- action . displayName = name
353- return [ stateCb , action ]
354- } ) ,
355- } )
356- }
357-
358- return Object . keys ( configuration . reactions [ name ] || { } ) . reduce (
359- ( aggr , subName ) =>
360- Object . assign ( aggr , {
361- [ name + '.' + subName ] : configuration . reactions [ name ] (
362- ( stateCb , action ) => {
363- action . displayName = name + '.' + subName
364- return [ stateCb , action ]
365- }
366- ) ,
367- } ) ,
368- { }
369- )
370- } ,
371- { }
372- )
373- }
374344 private getState ( configuration : Configuration ) {
375345 let state = { }
376346 if ( configuration . state ) {
0 commit comments