Skip to content

Commit

Permalink
perf(useQueries): optimize excessive invocations of getQueries in use…
Browse files Browse the repository at this point in the history
…Queries (#5255)

Co-authored-by: aemad01 <ahmedeamd199824@gmail.com>
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
  • Loading branch information
3 people committed Apr 15, 2023
1 parent 5be2530 commit e66a285
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-query/src/useQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ export function useQueries<T extends any[]>({
if (suspensePromises.length > 0) {
throw Promise.all(suspensePromises)
}

const observerQueries = observer.getQueries()
const firstSingleResultWhichShouldThrow = optimisticResult.find(
(result, index) =>
getHasError({
result,
errorResetBoundary,
useErrorBoundary: defaultedQueries[index]?.useErrorBoundary ?? false,
query: observer.getQueries()[index]!,
query: observerQueries[index]!,
}),
)

Expand Down

0 comments on commit e66a285

Please sign in to comment.