@powersync/react 0.0.0-dev-20250915110424 → 0.0.0-dev-20250922105207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -30,36 +30,17 @@ export const useWatchedQuery = (options) => {
|
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
watchedQuery?.close();
|
|
32
32
|
setWatchedQuery(createWatchedQuery);
|
|
33
|
-
return () => {
|
|
34
|
-
watchedQuery?.close();
|
|
35
|
-
};
|
|
36
33
|
}, [powerSync, active]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* Only overriding when the `queryChanged` value is true also prevents races if the query changes
|
|
50
|
-
* rapidly.
|
|
51
|
-
*/
|
|
52
|
-
if (queryChanged) {
|
|
53
|
-
watchedQuery?.updateSettings({
|
|
54
|
-
query,
|
|
55
|
-
throttleMs: hookOptions.throttleMs,
|
|
56
|
-
reportFetching: hookOptions.reportFetching
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const shouldReportCurrentlyFetching = (hookOptions.reportFetching ?? true) && queryChanged;
|
|
60
|
-
const result = useNullableWatchedQuerySubscription(watchedQuery);
|
|
61
|
-
return {
|
|
62
|
-
...result,
|
|
63
|
-
isFetching: result?.isFetching || shouldReportCurrentlyFetching
|
|
64
|
-
};
|
|
34
|
+
// Indicates that the query will be re-fetched due to a change in the query.
|
|
35
|
+
// Used when `isFetching` hasn't been set to true yet due to React execution.
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (queryChanged) {
|
|
38
|
+
watchedQuery?.updateSettings({
|
|
39
|
+
query,
|
|
40
|
+
throttleMs: hookOptions.throttleMs,
|
|
41
|
+
reportFetching: hookOptions.reportFetching
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, [queryChanged]);
|
|
45
|
+
return useNullableWatchedQuerySubscription(watchedQuery);
|
|
65
46
|
};
|
|
@@ -47,7 +47,7 @@ export const constructCompatibleQuery = (query, parameters = [], options) => {
|
|
|
47
47
|
execute: () => query.execute()
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
}, [query, powerSync
|
|
50
|
+
}, [query, powerSync]);
|
|
51
51
|
const queryChanged = checkQueryChanged(parsedQuery, options);
|
|
52
52
|
return {
|
|
53
53
|
parsedQuery,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/react",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250922105207",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://docs.powersync.com",
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@powersync/common": "0.0.0-dev-
|
|
27
|
+
"@powersync/common": "0.0.0-dev-20250922105207",
|
|
28
28
|
"react": "*"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
"react": "18.3.1",
|
|
36
36
|
"react-dom": "18.3.1",
|
|
37
37
|
"react-error-boundary": "^4.1.0",
|
|
38
|
-
"@powersync/common": "0.0.0-dev-
|
|
39
|
-
"@powersync/web": "0.0.0-dev-
|
|
40
|
-
"@powersync/drizzle-driver": "0.6.0"
|
|
38
|
+
"@powersync/common": "0.0.0-dev-20250922105207",
|
|
39
|
+
"@powersync/web": "0.0.0-dev-20250922105207"
|
|
41
40
|
},
|
|
42
41
|
"scripts": {
|
|
43
42
|
"build": "tsc -b",
|