@powersync/react 0.0.0-dev-20241008113658 → 0.0.0-dev-20241008145307
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.
- package/lib/hooks/useQuery.js +2 -2
- package/package.json +1 -1
package/lib/hooks/useQuery.js
CHANGED
|
@@ -43,15 +43,15 @@ export const useQuery = (query, parameters = [], options = { runQueryOnce: false
|
|
|
43
43
|
JSON.stringify(previousQueryRef.current.memoizedParams) != JSON.stringify(memoizedParams), [powerSync, sqlStatement, memoizedParams, isFetching]);
|
|
44
44
|
previousQueryRef.current = { sqlStatement, memoizedParams };
|
|
45
45
|
const handleResult = (result) => {
|
|
46
|
+
setData(result);
|
|
46
47
|
setIsLoading(false);
|
|
47
48
|
setIsFetching(false);
|
|
48
|
-
setData(result);
|
|
49
49
|
setError(undefined);
|
|
50
50
|
};
|
|
51
51
|
const handleError = (e) => {
|
|
52
|
+
setData([]);
|
|
52
53
|
setIsLoading(false);
|
|
53
54
|
setIsFetching(false);
|
|
54
|
-
setData([]);
|
|
55
55
|
const wrappedError = new Error('PowerSync failed to fetch data: ' + e.message);
|
|
56
56
|
wrappedError.cause = e;
|
|
57
57
|
setError(wrappedError);
|