Skip to content

Commit 8a42cda

Browse files
cleanup
1 parent 8208ac0 commit 8a42cda

4 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/common/src/client/watched/WatchedQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export interface WatchedQueryListener extends BaseListener {
8383
subscriptionsChanged: (counts: SubscriptionCounts) => void;
8484
}
8585

86-
export interface WatchedQuery<Data, Settings extends WatchedQueryOptions<Data> = WatchedQueryOptions<Data>>
86+
export interface WatchedQuery<Data = unknown, Settings extends WatchedQueryOptions<Data> = WatchedQueryOptions<Data>>
8787
extends BaseObserverInterface<WatchedQueryListener> {
8888
/**
8989
* Current state of the watched query.

packages/common/src/client/watched/WatchedQueryBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export enum IncrementalWatchMode {
88
* Builds a {@link WatchedQuery} instance given a set of options.
99
*/
1010
export interface WatchedQueryBuilder {
11-
build<DataType>(options: {}): WatchedQuery<DataType>;
11+
build(options: {}): WatchedQuery;
1212
}

packages/common/src/client/watched/processors/comparators.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ export interface WatchedQueryComparator<Data> {
22
checkEquality: (current: Data, previous: Data) => boolean;
33
}
44

5+
/**
6+
* Options for {@link ArrayComparator}
7+
*/
58
export type ArrayComparatorOptions<ItemType> = {
9+
/**
10+
* Returns a string to uniquely identify an item in the array.
11+
*/
612
compareBy: (item: ItemType) => string;
713
};
814

packages/react/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ function MyWidget() {
374374
const { data, isLoading } = useQuery(`SELECT * FROM cats WHERE breed = 'tabby'`, [], {
375375
comparator: new ArrayComparator({
376376
compareBy: (cat) => JSON.stringify(cat)
377+
},
377378
reportFetching: false
378379
})
379380

0 commit comments

Comments
 (0)