Skip to content

fix(solid-query): expose deferred SSR query errors#11060

Open
ckdwns9121 wants to merge 1 commit into
TanStack:mainfrom
ckdwns9121:agent/fix-solid-ssr-error-state
Open

fix(solid-query): expose deferred SSR query errors#11060
ckdwns9121 wants to merge 1 commit into
TanStack:mainfrom
ckdwns9121:agent/fix-solid-ssr-error-state

Conversation

@ckdwns9121

@ckdwns9121 ckdwns9121 commented Jul 13, 2026

Copy link
Copy Markdown

🎯 Changes

  • Read settled query properties from the Solid resource during SSR instead of the stale optimistic store.
  • Allow deferred query failures to expose status, isError, and error without requiring an ErrorBoundary.
  • Preserve the existing initial-error resolution path used by SolidStart redirects.
  • Add a patch changeset for @tanstack/solid-query.

The server subscriber resolves queryResource, but it does not synchronize the proxy-backed state. After a deferred query failed, server renders therefore kept reading the initial pending result. Reading the resolved resource on the server keeps rendered state aligned with the serialized resource.

Closes #8300

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

pnpm test:pr was attempted. Affected builds and tests ran, but the command failed in unrelated package type matrices because the local Corepack cache returned EACCES while spawning pnpm.cjs.

Focused validation passed:

  • pnpm --filter @tanstack/solid-query test:eslint
  • pnpm --filter @tanstack/solid-query test:types:tscurrent
  • pnpm --filter @tanstack/solid-query test:lib --run (322 tests)
  • pnpm --filter @tanstack/solid-query build
  • Manual Node SSR render: no data:error:true:SSR Error

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Improved server-side rendering for deferred queries by exposing settled query results once available.
    • Prevented deferred SSR output from remaining stuck on the initial optimistic state.

Deferred server queries settle in the resource while the proxy-backed store remains on its optimistic result. Read settled properties from the resource during SSR so query.error and the related status are renderable without forcing an ErrorBoundary.

Constraint: Preserve initial-error resolution used by SolidStart redirect flows.

Rejected: Reject the server resource for initial errors | would force ErrorBoundary handling and regress redirect behavior from TanStack#9841.

Confidence: high

Scope-risk: narrow

Directive: Keep server property reads aligned with the serialized resource result.

Tested: Solid Query ESLint, TypeScript current, 322 library tests, package build, and manual Node SSR render.

Not-tested: Automated SSR regression test because the current Vitest project resolves Solid's browser build.

Related: TanStack#8300
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1d4da516-7ff4-4662-a207-98594fc9f638

📥 Commits

Reviewing files that changed from the base of the PR and between 79d2384 and 76d3186.

📒 Files selected for processing (2)
  • .changeset/settled-ssr-state.md
  • packages/solid-query/src/useBaseQuery.ts

📝 Walkthrough

Walkthrough

useBaseQuery now exposes settled deferred query resource values during SSR, and a changeset documents the corresponding patch release for @tanstack/solid-query.

Changes

Solid Query SSR state

Layer / File(s) Summary
Settled SSR resource access
packages/solid-query/src/useBaseQuery.ts, .changeset/settled-ssr-state.md
Server-side proxy property reads use settled queryResource() values when available, and the changeset records the SSR behavior update and patch release.

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

Possibly related issues

  • Issue 10907 — Targets unresolved or stale server-rendered query state in useBaseQuery and deferred query resources.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: exposing deferred SSR query errors in Solid Query.
Linked Issues check ✅ Passed The SSR proxy now reads settled resource state, which should expose error-related fields for deferred queries as requested in #8300.
Out of Scope Changes check ✅ Passed The changes are limited to the SSR query fix and its changeset, with no unrelated scope added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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.

@ckdwns9121 ckdwns9121 marked this pull request as ready for review July 13, 2026 12:30
Sign up for free to 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: Error isn't being set when fetching via SSR

1 participant