Skip to content

Commit 8c46d9e

Browse files
committed
client update async
1 parent 35af1a3 commit 8c46d9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/query-core/src/queryClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,17 @@ export class QueryClient {
370370
resolveStaleTime(defaultedOptions.staleTime, query),
371371
)
372372

373-
const basePromise = isStale
374-
? query.fetch(defaultedOptions)
375-
: Promise.resolve(query.state.data as TQueryData)
373+
const queryData = isStale
374+
? await query.fetch(defaultedOptions)
375+
: (query.state.data as TQueryData)
376376

377377
const select = defaultedOptions.select
378378

379379
if (select) {
380-
return basePromise.then((data) => select(data))
380+
return select(queryData)
381381
}
382382

383-
return basePromise.then((data) => data as unknown as TData)
383+
return queryData as unknown as TData
384384
}
385385

386386
fetchQuery<

0 commit comments

Comments
 (0)