Skip to content
Source
Sign inSign up
TanStack/query

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

Openckdwns9121(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/11060/headopened View on GitHub

🎯 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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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 79d2384db5c8776680d5bfbe9b595618c066248b and 76d318644d52151a8781c9ba1320a9542c10ac4e.

      📒 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 nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title matches the main change: exposing deferred SSR query errors in Solid Query.
      Linked Issues check✅ PassedThe 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✅ PassedThe changes are limited to the SSR query fix and its changeset, with no unrelated scope added.
      Docstring Coverage✅ PassedNo 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.

Sign in to join this conversation.