Skip to content
Source
Sign inSign up
TanStack/db

fix(react-db, svelte-db): show infinite-query data on the first render #2027

MergedKyleAMathewsmerged 20 commits intomain fromrefs/pull/2027/headmerged by KyleAMathews

Showing 18 changed files with 7 additions and 0 deletions (loading 17).

x
0 of 18 viewed, 18 left
7 additions and 0 deletions.changeset/infinite-query-no-empty-first-paint.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/db': patch
+'@tanstack/react-db': patch
+'@tanstack/svelte-db': patch
+---
+​
+Fix `useLiveInfiniteQuery` showing an empty idle result on its first render for a synchronously loaded source. The hook now starts sync during render, as `useLiveQuery` does, so the first committed render already shows the ready first page instead of flashing empty content before data arrives. This applies to query callbacks and to supplied live query collections whose window is exactly the first page or has no limit. A supplied collection with a wider finite limit waits for the hook to narrow its window at commit, so it never requests rows the hook does not need. Renders that never commit are reclaimed by garbage collection, and a React 19 StrictMode double render reuses one collection instead of starting two. In React, a startup error from a replacement query still reaches the error boundary, and the hook rejects a source replaced by a different collection with the same ID while it is mounted, as `useLiveQuery` does.
docs/contributing/oracle-reviews/2026-10-05-infinite-first-paint.mdAdded
View file
Loading the diff
docs/contributing/oracle-coverage.mdModified
View file
Loading the diff