From 6c4763db094c0246e6bbcac4b7abac56e9ad5670 Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Sat, 31 Jan 2026 13:50:23 +0900 Subject: [PATCH] refactor(react-query/useQueries): remove unreachable 'willFetch' branch in suspense promise collection --- packages/react-query/src/useQueries.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/react-query/src/useQueries.ts b/packages/react-query/src/useQueries.ts index 6eabef4060..de179837a5 100644 --- a/packages/react-query/src/useQueries.ts +++ b/packages/react-query/src/useQueries.ts @@ -19,7 +19,6 @@ import { ensureSuspenseTimers, fetchOptimistic, shouldSuspend, - willFetch, } from './suspense' import type { DefinedUseQueryResult, @@ -294,13 +293,9 @@ export function useQueries< ? optimisticResult.flatMap((result, index) => { const opts = defaultedQueries[index] - if (opts) { + if (opts && shouldSuspend(opts, result)) { const queryObserver = new QueryObserver(client, opts) - if (shouldSuspend(opts, result)) { - return fetchOptimistic(opts, queryObserver, errorResetBoundary) - } else if (willFetch(result, isRestoring)) { - void fetchOptimistic(opts, queryObserver, errorResetBoundary) - } + return fetchOptimistic(opts, queryObserver, errorResetBoundary) } return [] })