Skip to content

Commit 37120f6

Browse files
add more doc comments
1 parent c55dc01 commit 37120f6

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

packages/react/src/hooks/watched/watch-types.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ export interface AdditionalOptions extends HookWatchOptions {
99
}
1010

1111
export interface DifferentialHookOptions<RowType> extends HookWatchOptions {
12+
/**
13+
* Used to detect and report differences in query result sets.
14+
*
15+
* By default the hook will requery on any dependent table change. This will
16+
* emit a new hook result even if the result set has not changed.
17+
*
18+
* Specifying a {@link WatchedQueryDifferentiator} will remove emissions for
19+
* unchanged result sets and preserve Array object references between result set emissions.
20+
* @example
21+
* ```javascript
22+
* {
23+
* differentiator: {
24+
* identify: (item) => item.id,
25+
* compareBy: (item) => JSON.stringify(item)
26+
* }
27+
* }
28+
* ```
29+
*/
1230
differentiator?: WatchedQueryDifferentiator<RowType>;
1331
}
1432

packages/vue/src/composables/useSingleQuery.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ import { usePowerSync } from './powerSync';
1010

1111
export interface AdditionalOptions<RowType = unknown> extends Omit<SQLOnChangeOptions, 'signal'> {
1212
runQueryOnce?: boolean;
13+
/**
14+
* Used to detect and report differences in query result sets.
15+
*
16+
* By default the hook will requery on any dependent table change. This will
17+
* emit a new hook result even if the result set has not changed.
18+
*
19+
* Specifying a {@link WatchedQueryDifferentiator} will remove emissions for
20+
* unchanged result sets and preserve Array object references between result set emissions.
21+
* @example
22+
* ```javascript
23+
* {
24+
* differentiator: {
25+
* identify: (item) => item.id,
26+
* compareBy: (item) => JSON.stringify(item)
27+
* }
28+
* }
29+
* ```
30+
*/
1331
differentiator?: WatchedQueryDifferentiator<RowType>;
1432
}
1533

0 commit comments

Comments
 (0)