Skip to content

useLiveSuspenseQuery leaves a derived collection pending after parameterized nested-query re-evaluation #1727

Description

@meesvandongen

Describe the bug

A derived collection created by a parameterized nested query renders for its
first document but remains pending when the parameter changes to a second
document. The identical query succeeds with useLiveQuery.

To reproduce

https://github.com/meesvandongen/tanstack-db-repro

pnpm install
pnpm run repro

The example displays a Documents view and a Tags view. The Tags view evaluates
a query for the selected document:

Document -> folder membership -> folder -> tag

The test changes the selected document through the UI and performs:

  1. Select Documents.
  2. Select Document A.
  3. Select Details, then Tags.
  4. Return to Documents.
  5. Select Document B.
  6. Select Details, then Tags.

Output:

useLiveSuspenseQuery Document A 1
useLiveSuspenseQuery Document B 0
useLiveQuery Document A 1
useLiveQuery Document B 1

The number is the count of rendered tag views. The first two lines use
useLiveSuspenseQuery; the last two are the useLiveQuery control.

Expected behavior

Both Document A and Document B should render their tag view.

Actual behavior

The second useLiveSuspenseQuery view does not render within the test
interval, while the non-Suspense control renders both views.

Versions:

  • @tanstack/db: 0.6.17
  • @tanstack/electric-db-collection: 0.3.15
  • @tanstack/react-db: 0.1.95
  • react: 19.2.8
  • vite: 8.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions