Skip to content

Commit d56ee6a

Browse files
committed
docs: add docs for dynamic options comparer
1 parent 544671b commit d56ee6a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/api/Query.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,22 @@ query.update({ queryKey: ['bar' ]});
733733
// will be removed
734734
```
735735

736+
### `dynamicOptionsComparer` <Badge type="tip">QueryFeature</Badge>
737+
738+
Allows to set custom comparer for reactions that update query options dynamically (options property)
739+
740+
Default: unset
741+
742+
Example:
743+
```ts
744+
const query = new Query({
745+
dynamicOptionsComparer: () => true, // means options always equal
746+
options: () => ({
747+
enabled: false,
748+
})
749+
})
750+
```
751+
736752
## Recommendations
737753

738754
### Don't forget about `abortSignal`s or `lazy` option

src/query.types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ export interface QueryFeatures {
174174
*/
175175
autoRemovePreviousQuery?: boolean;
176176

177+
/**
178+
* Custom comparer for dynamic options reactions
179+
*
180+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query/api/Query.html#dynamicoptionscomparer)
181+
*/
177182
dynamicOptionsComparer?: IReactionOptions<any, any>['equals'];
178183
}
179184

0 commit comments

Comments
 (0)