Skip to content

Commit 75d2f29

Browse files
committed
fix(table): re-throw on infinite-query fetch error in append-row drain
`useInfiniteQuery.fetchNextPage()` resolves (rather than rejects) when a page request fails — the resolved value carries `status: 'error'` while `hasNextPage` still reflects the last successful page. The drain loop in `handleAppendRow` relied on a thrown error to bail, so a failed mid-drain fetch could spin indefinitely and leave the append guard stuck on. Re-throw inside `fetchNextPageWrapped` when the result is an error so the caller's `try/catch` runs as intended.
1 parent 6b79524 commit 75d2f29

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table-data.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export function useTableData({
6363

6464
const fetchNextPageWrapped = useCallback(async () => {
6565
const result = await fetchNextPage()
66+
if (result.status === 'error') {
67+
throw result.error ?? new Error('Failed to fetch next page')
68+
}
6669
return { hasNextPage: Boolean(result.hasNextPage) }
6770
}, [fetchNextPage])
6871

0 commit comments

Comments
 (0)