@@ -111,6 +111,7 @@ export class MobxQuery<
111111
112112 if ( this . isStaticDisabled ) {
113113 this . holdedEnabledOption = undefined ;
114+ console . info ( 'hold(3)' , `${ this . holdedEnabledOption } ` ) ;
114115 }
115116
116117 if ( typeof queryKeyOrDynamicQueryKey === 'function' ) {
@@ -228,6 +229,10 @@ export class MobxQuery<
228229 this . queryObserver . setOptions ( this . options ) ;
229230 }
230231
232+ private isEnableHolded = false ;
233+
234+ private enableHolder = ( ) => false ;
235+
231236 private processOptions = (
232237 options : MobxQueryOptions < TData , TError , TQueryKey > ,
233238 ) => {
@@ -238,12 +243,22 @@ export class MobxQuery<
238243 // to do this, we hold the original value of the enabled option
239244 // and set enabled to false until the user requests the result (this.isResultRequsted)
240245 if ( this . isEnabledOnResultDemand ) {
246+ if ( this . isEnableHolded && options . enabled !== this . enableHolder ) {
247+ this . holdedEnabledOption = options . enabled ;
248+ }
249+
241250 if ( this . isResultRequsted ) {
242- options . enabled = this . holdedEnabledOption ;
243- this . holdedEnabledOption = undefined ;
251+ if ( this . isEnableHolded ) {
252+ options . enabled =
253+ this . holdedEnabledOption === this . enableHolder
254+ ? undefined
255+ : this . holdedEnabledOption ;
256+ this . isEnableHolded = false ;
257+ }
244258 } else {
259+ this . isEnableHolded = true ;
245260 this . holdedEnabledOption = options . enabled ;
246- options . enabled = false ;
261+ options . enabled = this . enableHolder ;
247262 }
248263 }
249264 } ;
0 commit comments