Skip to content

Commit 3a6bef6

Browse files
Add automated profiling benchmarks
1 parent f8f7b6d commit 3a6bef6

File tree

5 files changed

+523
-107
lines changed

5 files changed

+523
-107
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface WatchedQueryDifferential<RowType> {
2727
*
2828
* If a previous result set contains an item (A) `{name: 'pc', make: 'Cool PC'}` and
2929
* an update has been made which adds another item (B) to the result set (the item A is unchanged) - then
30-
* the updated result set will be contain the same object reference,to item A, as the previous resultset.
30+
* the updated result set will be contain the same object reference, to item A, as the previous result set.
3131
* This is regardless of the item A's position in the updated result set.
3232
*/
3333
all: ReadonlyArray<RowType>;
@@ -145,6 +145,8 @@ export class DifferentialQueryProcessor<RowType>
145145
diff.unchanged.push(item);
146146
// Use the previous object reference
147147
diff.all.push(previousItem.item);
148+
// update the map to preserve the reference
149+
currentMap.set(key, previousItem);
148150
} else {
149151
hasChanged = true;
150152
diff.updated.push({ current: item, previous: previousItem.item });

packages/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"@types/react": "^18.3.1",
4040
"jsdom": "^24.0.0",
4141
"react": "18.3.1",
42+
"react-dom": "18.3.1",
4243
"react-error-boundary": "^4.1.0"
4344
}
4445
}

packages/react/src/hooks/watched/useQuery.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const useQuery = <RowType = any>(
4343
powerSync,
4444
queryChanged,
4545
options: {
46+
reportFetching: options.reportFetching,
4647
// Maintains backwards compatibility with previous versions
4748
// Comparisons are opt-in by default
4849
// We emit new data for each table change by default.

0 commit comments

Comments
 (0)