Skip to content

Commit c5a9eb5

Browse files
DominicGBauerDominicGBauer
andauthored
fix: react hook not updating data (#149)
Co-authored-by: DominicGBauer <dominic@nomanini.com>
1 parent d62f367 commit c5a9eb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/react/src/hooks/useQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type QueryResult<T> = {
3939
export const useQuery = <T = any>(
4040
sqlStatement: string,
4141
parameters: any[] = [],
42-
options: AdditionalOptions = {}
42+
options: AdditionalOptions = { runQueryOnce: false }
4343
): QueryResult<T> => {
4444
const powerSync = usePowerSync();
4545
if (!powerSync) {
@@ -96,7 +96,7 @@ export const useQuery = <T = any>(
9696
await fetchTables();
9797
await fetchData();
9898
})();
99-
}, []);
99+
}, [powerSync, memoizedParams, sqlStatement]);
100100

101101
React.useEffect(() => {
102102
// Abort any previous watches

0 commit comments

Comments
 (0)