Skip to content

Commit 9b4d31b

Browse files
committed
fix(react-query): refine throwOnError retry logic for error boundary cases
When throwOnError is a function, allow retryOnMount to proceed even when error boundary hasn't reset, while maintaining the prevention behavior for boolean throwOnError values.
1 parent bf3034c commit 9b4d31b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-query/src/errorBoundaryUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@ export const ensurePreventErrorBoundaryRetry = <
2828
) => {
2929
if (
3030
options.suspense ||
31-
options.throwOnError ||
3231
options.experimental_prefetchInRender
3332
) {
3433
// Prevent retrying failed query if the error boundary has not been reset yet
3534
if (!errorResetBoundary.isReset()) {
3635
options.retryOnMount = false
3736
}
37+
} else if (options.throwOnError) {
38+
if (!errorResetBoundary.isReset() && typeof options.throwOnError !== 'function') {
39+
options.retryOnMount = false
40+
}
3841
}
3942
}
4043

0 commit comments

Comments
 (0)