Skip to content

fix(solid-query): fetch on status-only reads#10838

Open
raashish1601 wants to merge 3 commits into
TanStack:mainfrom
raashish1601:fix/solid-query-status-resource
Open

fix(solid-query): fetch on status-only reads#10838
raashish1601 wants to merge 3 commits into
TanStack:mainfrom
raashish1601:fix/solid-query-status-resource

Conversation

@raashish1601
Copy link
Copy Markdown
Contributor

@raashish1601 raashish1601 commented May 30, 2026

Summary

  • Track Solid query status-like result fields in useBaseQuery so status/resource-only consumers trigger createResource/observer work, fixing lazy start for curried queryOptions results.
  • Add regression tests in packages/solid-query/src/tests/useQuery.test.tsx for status-only reads and resource field reads.
  • Add changeset for @tanstack/solid-query patch release.

Validation

  • corepack pnpm --filter @tanstack/solid-query test:lib -- --run src/tests/useQuery.test.tsx
    (fails in this environment due pre-existing Vitest issue: TypeError: filename must be a file URL object, file URL string, or absolute path string. Received 'file:///@solid-refresh' and related
    oot.eslint.config.js typecheck parser errors)

Summary by CodeRabbit

  • Bug Fixes

    • Query resources now initialize when status fields (loading, error, etc.) are read, ensuring queries run even without direct data access.
    • Devtools stylesheet setup records a provided nonce and applies it to the style element.
  • Tests

    • Added tests verifying queries run with curried queryOptions when accessing status- or resource-related fields.
    • Added tests for stylesheet nonce behavior.
  • Chores

    • Added a changeset entry for the package.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0e76deb6-8ad1-4b37-a9a1-881384ad1256

📥 Commits

Reviewing files that changed from the base of the PR and between 60e16bf and c0529d2.

📒 Files selected for processing (2)
  • packages/query-devtools/src/__tests__/utils.test.ts
  • packages/query-devtools/src/utils.tsx

📝 Walkthrough

Walkthrough

Reads of status/error/fetch-related properties on Solid Query results now force the Solid resource to be read, starting observer subscriptions and fetches for curried queryOptions. Tests and a changeset were added; devtools stylesheet nonce handling was also updated and tested.

Changes

Status Field Resource Tracking

Layer / File(s) Summary
Resource tracking and proxy initialization
packages/solid-query/src/useBaseQuery.ts
Defines resourceTrackingProps set of status/error/fetch property keys; Proxy getter forces queryResource() read when these properties are accessed to initialize observer and fetch.
Test coverage for curried queryOptions
packages/solid-query/src/__tests__/useQuery.test.tsx
Adds queryOptions import and two tests validating that a curried queryOptions triggers the query when only status-related or only resource-related fields are read, advancing timers and asserting success.
Changeset documentation
.changeset/solid-query-status-resource.md
Adds a patch changeset documenting that status-field access starts Solid query resources, enabling mount-time fetch for curried queryOptions.

Devtools stylesheet nonce handling

Layer / File(s) Summary
Expose nonce on window and tests
packages/query-devtools/src/utils.tsx, packages/query-devtools/src/__tests__/utils.test.ts
setupStyleSheet writes provided nonce to window.__nonce__; tests add teardown to delete window.__nonce__ and a case asserting setupStyleSheet('test-nonce') sets window.__nonce__.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • TkDodo
  • chughgaurav

Poem

🐇 I nudge a status, a gentle tap,
the resource wakes from a quiet nap.
Curried options hum, timers run,
fetch starts early — the work is done.
A rabbit cheers: behold the map!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description covers the changes made, includes regression tests, and mentions a changeset. However, the checklist section from the template is completely missing. Complete the checklist section from the template by indicating whether the Contributing guide was followed and if testing with 'pnpm run test:pr' was performed.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: enabling Solid query to fetch when only status fields are read, which is the core problem addressed in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

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.

1 participant