@powersync/react 0.0.0-dev-20241008145307 → 0.0.0-dev-20241021121317
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 -1
- package/package.json +1 -1
package/lib/hooks/useQuery.js
CHANGED
|
@@ -41,14 +41,15 @@ export const useQuery = (query, parameters = [], options = { runQueryOnce: false
|
|
|
41
41
|
// Used when `isFetching` hasn't been set to true yet due to React execution.
|
|
42
42
|
const shouldFetch = React.useMemo(() => previousQueryRef.current.sqlStatement !== sqlStatement ||
|
|
43
43
|
JSON.stringify(previousQueryRef.current.memoizedParams) != JSON.stringify(memoizedParams), [powerSync, sqlStatement, memoizedParams, isFetching]);
|
|
44
|
-
previousQueryRef.current = { sqlStatement, memoizedParams };
|
|
45
44
|
const handleResult = (result) => {
|
|
45
|
+
previousQueryRef.current = { sqlStatement, memoizedParams };
|
|
46
46
|
setData(result);
|
|
47
47
|
setIsLoading(false);
|
|
48
48
|
setIsFetching(false);
|
|
49
49
|
setError(undefined);
|
|
50
50
|
};
|
|
51
51
|
const handleError = (e) => {
|
|
52
|
+
previousQueryRef.current = { sqlStatement, memoizedParams };
|
|
52
53
|
setData([]);
|
|
53
54
|
setIsLoading(false);
|
|
54
55
|
setIsFetching(false);
|