TanStack / TanStack/db

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

Open
#1,727 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.9k
Forks
266
Avg merge
1d 4h
Merged PRs (30d)
55

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the linked tanstack-db-repro project with pnpm install and pnpm run repro, following the documented document-selection sequence. Compare the useLiveSuspenseQuery and useLiveQuery results; done means both Document A and Document B render their tag views within the test interval.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.