Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/bindings-typescript/src/react/useTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ export function useTable<TableDef extends UntypedTableDef>(
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [connectionState, accessorName, querySql, subscribeApplied]);

// Invalidate the cached snapshot when computeSnapshot changes (e.g. when
// subscribeApplied flips to true) so getSnapshot() recomputes on the next
// render instead of returning a stale [rows, false] tuple.
useEffect(() => {
lastSnapshotRef.current = null;
}, [computeSnapshot]);

useEffect(() => {
const connection = connectionState.getConnection()!;
if (connectionState.isActive && connection) {
Expand Down
Loading