·
3 commits
to main
since this release
Minor Changes
-
c7d2b53: - [Internal] Updated implementation to use shared
WatchedQuery
implementation. -
c7d2b53: - Added the ability to limit re-renders by specifying a
rowComparator
for query results. TheuseQuery
hook will only emitdata
changes when the data has changed.// The data here will maintain previous object references for unchanged items. const { data } = useQuery('SELECT * FROM lists WHERE name = ?', ['aname'], { rowComparator: { keyBy: (item) => item.id, compareBy: (item) => JSON.stringify(item) } });
- Added the ability to subscribe to an existing instance of a
WatchedQuery
import { useWatchedQuerySubscription } from '@powersync/react'; const listsQuery = powerSync .query({ sql: `SELECT * FROM lists` }) .differentialWatch(); export const ListsWidget = (props) => { const { data: lists } = useWatchedQuerySubscription(listsQuery); return ( <div> {lists.map((list) => ( <div key={list.id}>{list.name}</div> ))} </div> ); };
- Added the ability to subscribe to an existing instance of a