File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
2222 runInAction ,
2323} from 'mobx' ;
2424
25- import { MobxQueryInvalidateParams } from './mobx-query' ;
25+ import { MobxQueryInvalidateParams , MobxQueryResetParams } from './mobx-query' ;
2626
2727export interface MobxInfiniteQueryConfig <
2828 TData ,
@@ -311,10 +311,11 @@ export class MobxInfiniteQuery<
311311 return await this . queryObserver . refetch ( options ) ;
312312 }
313313
314- async reset ( ) {
314+ async reset ( params ?: MobxQueryResetParams ) {
315315 await this . queryClient . resetQueries ( {
316316 queryKey : this . options . queryKey ,
317317 exact : true ,
318+ ...params ,
318319 } ) ;
319320 }
320321
Original file line number Diff line number Diff line change 44 hashKey ,
55 InvalidateQueryFilters ,
66 QueryClient ,
7+ QueryFilters ,
78 QueryKey ,
89 QueryObserver ,
910 QueryObserverOptions ,
@@ -23,6 +24,9 @@ import {
2324export interface MobxQueryInvalidateParams
2425 extends Partial < Omit < InvalidateQueryFilters , 'queryKey' | 'exact' > > { }
2526
27+ export interface MobxQueryResetParams
28+ extends Partial < Omit < QueryFilters , 'queryKey' | 'exact' > > { }
29+
2630export interface MobxQueryConfig <
2731 TData ,
2832 TError = DefaultError ,
@@ -239,10 +243,11 @@ export class MobxQuery<
239243 this . _result = nextResult || { } ;
240244 }
241245
242- async reset ( ) {
246+ async reset ( params ?: MobxQueryResetParams ) {
243247 await this . queryClient . resetQueries ( {
244248 queryKey : this . options . queryKey ,
245249 exact : true ,
250+ ...params ,
246251 } ) ;
247252 }
248253
You can’t perform that action at this time.
0 commit comments