File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
1919 MobxQueryInvalidateParams ,
2020 MobxQueryUpdateOptions ,
2121} from './mobx-query.types' ;
22+ import { createQuery } from './preset' ;
2223
2324class MobxQueryMock <
2425 TData ,
@@ -1101,5 +1102,26 @@ describe('MobxQuery', () => {
11011102 status : 'pending' ,
11021103 } ) ;
11031104 } ) ;
1105+
1106+ it ( 'options is not reactive when updating after creating #10' , ( ) => {
1107+ const enabled = observable . box ( false ) ;
1108+
1109+ const queryFnSpy = vi . fn ( ) ;
1110+ const getDynamicOptionsSpy = vi . fn ( ) ;
1111+
1112+ createQuery ( queryFnSpy , {
1113+ options : ( ) => {
1114+ getDynamicOptionsSpy ( ) ;
1115+ return {
1116+ enabled : enabled . get ( ) ,
1117+ } ;
1118+ } ,
1119+ } ) ;
1120+
1121+ enabled . set ( true ) ;
1122+
1123+ expect ( queryFnSpy ) . toBeCalledTimes ( 1 ) ;
1124+ expect ( getDynamicOptionsSpy ) . toBeCalledTimes ( 3 ) ;
1125+ } ) ;
11041126 } ) ;
11051127} ) ;
You can’t perform that action at this time.
0 commit comments