Skip to content

Commit

Permalink
fix: use correct parameters variable in memoized params (#152)
Browse files Browse the repository at this point in the history
Co-authored-by: DominicGBauer <[email protected]>
  • Loading branch information
DominicGBauer and DominicGBauer authored May 2, 2024
1 parent c94be6a commit 7a05cae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/hooks/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const useQuery = <T = any>(
const [isFetching, setIsFetching] = React.useState(true);
const [tables, setTables] = React.useState([]);

const memoizedParams = React.useMemo(() => parameters, [...queryParameters]);
const memoizedParams = React.useMemo(() => queryParameters, [...queryParameters]);
const memoizedOptions = React.useMemo(() => options, [JSON.stringify(options)]);
const abortController = React.useRef(new AbortController());

Expand All @@ -85,7 +85,7 @@ export const useQuery = <T = any>(
const fetchData = async () => {
setIsFetching(true);
try {
const result = await powerSync.getAll<T>(sqlStatement, parameters);
const result = await powerSync.getAll<T>(sqlStatement, queryParameters);
handleResult(result);
} catch (e) {
console.error('Failed to fetch data:', e);
Expand Down

0 comments on commit 7a05cae

Please sign in to comment.