File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " mobx-tanstack-query " : patch
3+ ---
4+
5+ fixed cumulativeQueryHash work
Original file line number Diff line number Diff line change @@ -595,8 +595,13 @@ export class Query<
595595 async reset ( params ?: QueryResetParams , options ?: ResetOptions ) {
596596 if ( this . cumulativeQueryHash ) {
597597 return await this . queryClient . resetQueries ( {
598- predicate : ( query ) =>
599- this . cumulativeQueryKeyHashesSet . has ( query . options . queryHash ! ) ,
598+ predicate : ( query ) => {
599+ return (
600+ this . cumulativeQueryKeyHashesSet . has ( query . options . queryHash ! ) &&
601+ query . observers . length === 1 &&
602+ query . observers [ 0 ] === this . queryObserver
603+ ) ;
604+ } ,
600605 ...params ,
601606 } ) ;
602607 }
@@ -615,7 +620,9 @@ export class Query<
615620 if ( this . cumulativeQueryHash ) {
616621 return this . queryClient . removeQueries ( {
617622 predicate : ( query ) =>
618- this . cumulativeQueryKeyHashesSet . has ( query . options . queryHash ! ) ,
623+ this . cumulativeQueryKeyHashesSet . has ( query . options . queryHash ! ) &&
624+ query . observers . length === 1 &&
625+ query . observers [ 0 ] === this . queryObserver ,
619626 ...params ,
620627 } ) ;
621628 }
You can’t perform that action at this time.
0 commit comments