TanStack / TanStack/query

Solid Suspense is triggered on data access after checking isSuccess when loaded by ensureQueryData

Open
#9,955 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package: solid-query
Dominant language
TypeScript
Stars
50.3k
Forks
4.2k
Avg merge
18h 25m
Merged PRs (30d)
200

Description

Describe the bug

Hi there, I'm running into a weird issue where a suspense is being triggered even after checking that isSuccess is true, but only if the data was loaded from an ensureQueryData call (I've only tested this from a createFileRoute loader, maybe that's somehow related?).

It seems like somehow the Solid resource ends up behind the query. I'm not very familiar with the TanStack or Solid code, but in digging through the debugger in Chrome I found this suspect situation. The getter on the query identifies that the data exists (and while I'm here I can see the isSuccess set to true) and tries to load the latest data from the Solid resource:

Image

But the Solid resource doesn't believe the fetcher was resolved yet, leading to it triggering a read which adds to the suspense context instead of just returning the value:

Image
Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-router-lwma9xac?file=src%2Froutes%2Fposts.tsx

Steps to reproduce
  1. Visit the posts page (/posts) in the sandbox, and observe that the wasMounted signal remains false.
  2. Uncomment the loader section (in src/routes/posts.tsx), and observe that the Suspense fallback is mounted.
Expected behavior

I expect that the query data getter would behave the same no matter how the data was initially loaded.

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform
  • OS: macOS
  • Browser: Safari 26.1, Chrome 142.0
Tanstack Query adapter

solid-query

TanStack Query version

5.90.12

TypeScript version

5.9.3

Additional context

I realize this seems like a tiny bug, and in almost any case I don't think it'd even be perceptible, but unfortunately the suspense is a significant problem for me because it breaks the iframe that Square's web payments SDK generates.

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

Start by running the StackBlitz reproduction and inspect src/routes/posts.tsx, first with the loader section commented out and then enabled. Trace how ensureQueryData affects the Solid resource and the query data getter when isSuccess is true. Done means the data getter behaves consistently in both cases and the Suspense fallback is not mounted unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.