Skip to content

refactor(preact-query/useQueries): remove unreachable 'willFetch' branch in suspense promise collection#10188

Merged
TkDodo merged 1 commit intoTanStack:mainfrom
sukvvon:refactor/preact-query-remove-unreachable-willFetch
Feb 26, 2026
Merged

refactor(preact-query/useQueries): remove unreachable 'willFetch' branch in suspense promise collection#10188
TkDodo merged 1 commit intoTanStack:mainfrom
sukvvon:refactor/preact-query-remove-unreachable-willFetch

Conversation

@sukvvon
Copy link
Contributor

@sukvvon sukvvon commented Feb 26, 2026

🎯 Changes

Apply the same refactoring from #10082 to preact-query. Remove the unreachable willFetch branch in useQueries.ts suspense promise collection, since shouldSuspend already covers the only reachable case.

  • Remove willFetch import from suspense
  • Simplify the suspense promise flatMap logic by combining opts and shouldSuspend checks

✅ Checklist

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

🚀 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

  • Refactor
    • Removed unreachable code paths and streamlined internal query logic.

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: 9e12337

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/preact-query Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7d102e and 9e12337.

📒 Files selected for processing (2)
  • .changeset/remove-unreachable-willfetch-preact.md
  • packages/preact-query/src/useQueries.ts

📝 Walkthrough

Walkthrough

A changeset documents a patch release for @tanstack/preact-query that removes unreachable code from the useQueries hook's suspense logic, specifically eliminating a willFetch branch and consolidating the fetch optimization call to simplify control flow.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/remove-unreachable-willfetch-preact.md
New changeset file documenting a patch release that refactors preact-query/useQueries to remove unreachable willFetch branch in suspense promise collection.
Suspense Logic Refactor
packages/preact-query/src/useQueries.ts
Simplified suspense handling by removing willFetch import and consolidating conditional logic; fetchOptimistic now executes only when opts is defined and shouldSuspend returns true, eliminating prior else-if and unreachable branches.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

package: preact-query

Suggested reviewers

  • TkDodo
  • manudeli

Poem

🐰 A branch once unreachable, now swept away,
Suspense logic flows in a cleaner way,
No willFetch ghosts to haunt the code,
Just fetchOptimistic on the simpler road! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly describes the main refactoring change: removing an unreachable 'willFetch' branch in the suspense promise collection of preact-query's useQueries hook.
Description check ✅ Passed The description follows the template with all required sections completed: Changes section explains the refactoring with references to prior work, Checklist items are marked as done, and Release Impact is properly documented with changeset confirmation.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@nx-cloud
Copy link

nx-cloud bot commented Feb 26, 2026

View your CI Pipeline Execution ↗ for commit 9e12337

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 14s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-26 01:34:34 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10188

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10188

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10188

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10188

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10188

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10188

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10188

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10188

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10188

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10188

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10188

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10188

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10188

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10188

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10188

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10188

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10188

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10188

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10188

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10188

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10188

commit: 9e12337

@TkDodo TkDodo merged commit b5e88e0 into TanStack:main Feb 26, 2026
7 checks passed
@github-actions github-actions bot mentioned this pull request Feb 26, 2026
@github-actions
Copy link
Contributor

🎉 This PR has been released!

Thank you for your contribution!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants