Skip to content

fix(solid-query): address suspense detachment in solid query#11113

Open
MaNaN1803 wants to merge 2 commits into
TanStack:mainfrom
MaNaN1803:fix/solid-query-suspense-detach
Open

fix(solid-query): address suspense detachment in solid query#11113
MaNaN1803 wants to merge 2 commits into
TanStack:mainfrom
MaNaN1803:fix/solid-query-suspense-detach

Conversation

@MaNaN1803

@MaNaN1803 MaNaN1803 commented Jul 24, 2026

Copy link
Copy Markdown

Resolves an issue in Solid Query where suspense detachment causes queries to fail or hang.

Summary by CodeRabbit

  • Bug Fixes
    • Improved client-side subscription handling to prevent redundant refetches when results haven’t changed.
    • Updated behavior to reuse fresh results directly when not in loading/error states, while still refetching when appropriate.
    • Enhanced observer result update logic for more reliable and efficient data refreshes.

@coderabbitai

coderabbitai Bot commented Jul 24, 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 Plus

Run ID: 3dbad87e-6426-4128-a636-b613e425c5a3

📥 Commits

Reviewing files that changed from the base of the PR and between 2935182 and b7f0996.

📒 Files selected for processing (1)
  • packages/solid-query/src/useBaseQuery.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/solid-query/src/useBaseQuery.ts

📝 Walkthrough

Walkthrough

useBaseQuery now validates the active subscription observer, conditionally refetches loading or error results, and reconciles other observer results through internal state updates.

Changes

Solid Query subscriber flow

Layer / File(s) Summary
Conditional subscriber update handling
packages/solid-query/src/useBaseQuery.ts
The subscriber exits when unsubscribed or when the observer changes, refetches for resolver or loading/error states, and otherwise applies setStateWithReconciliation(result).

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is just one sentence and omits the required Changes, Checklist, and Release Impact sections. Add the template sections for Changes, Checklist, and Release Impact, and fill in the testing and changeset details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the Solid Query suspense detachment fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/solid-query/src/useBaseQuery.ts`:
- Around line 186-187: Update the refetch condition in useBaseQuery so settled
error results do not trigger refetch(). Limit refetching to an active resolver
or loading transition, while preserving the existing behavior for those states.
- Around line 183-189: Update the queued callback in useBaseQuery to capture the
subscription/observer generation associated with observerResult and apply or
refetch only when that generation still matches the current subscription.
Increment the generation whenever createClientSubscriber replaces the observer
subscription, so results queued by a previous QueryObserver are ignored rather
than updating current Solid state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d7563bbf-e5bf-4e75-8b3c-2a9c10596181

📥 Commits

Reviewing files that changed from the base of the PR and between a3b0612 and 2935182.

📒 Files selected for processing (1)
  • packages/solid-query/src/useBaseQuery.ts

Comment thread packages/solid-query/src/useBaseQuery.ts
Comment thread packages/solid-query/src/useBaseQuery.ts Outdated
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