Skip to content

fix(solid-query): drop disabled idle SSR promise - #11015

Open
Gujiassh wants to merge 1 commit into
TanStack:mainfrom
Gujiassh:fix/solid-query-disabled-ssr-settle-10907
Open

fix(solid-query): drop disabled idle SSR promise#11015
Gujiassh wants to merge 1 commit into
TanStack:mainfrom
Gujiassh:fix/solid-query-disabled-ssr-settle-10907

Conversation

@Gujiassh

@GujiasshGujiassh commented Jul 2, 2026

Copy link
Copy Markdown

🎯 Changes

  • stop serializing the pending SSR promise for disabled idle solid-query results
  • keep the SSR promise intact for actively fetching queries
  • add server-side coverage for both disabled-idle and active-fetching cases

Closes#10907

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.
  • Additional local validation: pnpm --filter @tanstack/solid-query exec vitest run src/__tests__/useBaseQuery.server.test.ts

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).
  • This PR changes published Solid Query behavior. I have not added a changeset in this contribution.

@coderabbitai

coderabbitaiBot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The hydratableObserverResult function in useBaseQuery.ts is now exported and modified to delete the promise property when a query is disabled and idle during SSR, preventing indefinite suspension. A new test suite validates hydration behavior for disabled and actively fetching queries.

Changes

SSR Hydration Fix

Layer / File(s)Summary
Export and fix hydratableObserverResult
packages/solid-query/src/useBaseQuery.ts
hydratableObserverResult is now exported and deletes obj.promise when the query is disabled and fetchStatus is idle, preventing SSR from hanging on a never-resolving promise.
SSR hydration test coverage
packages/solid-query/src/__tests__/useBaseQuery.server.test.ts
New Vitest suite mocks solid-js/web to force server mode and verifies disabled idle queries omit promise/refetch, while active fetching queries retain promise.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
participant Resource as Solid Resource
participant useBaseQuery
participant hydratableObserverResult
Resource->>useBaseQuery: fetch during SSR render
useBaseQuery->>hydratableObserverResult: build hydration-safe result
alt query disabled and idle
hydratableObserverResult->>hydratableObserverResult: delete promise property
hydratableObserverResult-->>useBaseQuery: result without promise
useBaseQuery-->>Resource: resolves immediately
else query fetching
hydratableObserverResult-->>useBaseQuery: result with promise preserved
useBaseQuery-->>Resource: awaits pending promise
end
Loading

Related issues:#10907 — resolves the SSR hang caused by useQuery({ enabled: false }) never settling renderToStringAsync by stripping the dangling promise for disabled idle queries.

Suggested reviewers: ejose19, TkDodo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly and accurately summarizes the main fix for disabled idle SSR promises in solid-query.
Linked Issues check✅ PassedThe code and tests match #10907 by stripping the SSR promise for disabled idle queries while keeping it for fetching ones.
Out of Scope Changes check✅ PassedThe only changes are the SSR fix and focused server-side tests, which are directly related to the linked issue.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check✅ PassedThe PR description follows the required template and includes changes, checklist, testing notes, and release impact context.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Solid Query: useQuery({ enabled: false }) hangs renderToStringAsync (SSR) on 5.101.0

1 participant

@Gujiassh