{{ message }}
fix(preact-query): allow retryOnMount when throwOnError is function - #11166
Merged
TkDodo merged 2 commits intoAug 20, 2026
Merged
Conversation
Ports TanStack#9338 to preact-query: ensurePreventErrorBoundaryRetry now receives the cached query and evaluates a function-form throwOnError against the actual error before setting retryOnMount = false, instead of treating any function as truthy. Includes the regression tests from TanStack#9338, two of which fail on current main. Fixes TanStack#11165 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/preact-query/src/errorBoundaryUtils.ts`:
- Around line 30-33: The throwOnError logic should evaluate the predicate for
every query in an error state, including failures with falsy values such as 0,
empty string, or null. Replace the query.state.error truthiness guard with the
query’s established error-status check, preserving direct option handling for
non-error states, and add coverage for a falsy rejected value.
🪄 Autofix
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: 9e770acb-1a84-48ad-bfad-7ea1ea56d651
📒 Files selected for processing (5)
.changeset/preact-retry-on-mount-throw-on-error.mdpackages/preact-query/src/__tests__/useQuery.test.tsxpackages/preact-query/src/errorBoundaryUtils.tspackages/preact-query/src/useBaseQuery.tspackages/preact-query/src/useQueries.ts
TkDodo
approved these changes
Aug 20, 2026
Contributor
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
View your CI Pipeline Execution ↗ for commit e060a89
☁️ Nx Cloud last updated this comment at |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🎯 Changes
Fixes #11165.
Ports #9338 to
preact-query. react-query'sensurePreventErrorBoundaryRetryevaluates a function-formthrowOnErroragainst the query's actual error before disablingretryOnMount; preact-query's copy still treats any function as truthy, sothrowOnError: () => false(or a predicate returningfalsefor the current error) wrongly prevents an errored query from refetching on remount.errorBoundaryUtils.ts: accept the cached query and evaluate function-formthrowOnErrorviashouldThrowError, same as react-query.useBaseQuery.ts: look the query up once byqueryHashand reuse it forensurePreventErrorBoundaryRetry,getHasError, and theexperimental_prefetchInRenderpromise (mirrors the react-query shape after fix(react-query): allow retryOnMount when throwOnError is function (#9336) #9338).useQueries.ts: pass the cached query per defaulted options.mainand pass with this change.✅ Checklist
pnpm run test:pr.🚀 Release Impact
🤖 Generated with Claude Code
Summary by CodeRabbit
throwOnErroris configured as a function.