We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35af1a3 commit 8c46d9eCopy full SHA for 8c46d9e
packages/query-core/src/queryClient.ts
@@ -370,17 +370,17 @@ export class QueryClient {
370
resolveStaleTime(defaultedOptions.staleTime, query),
371
)
372
373
- const basePromise = isStale
374
- ? query.fetch(defaultedOptions)
375
- : Promise.resolve(query.state.data as TQueryData)
+ const queryData = isStale
+ ? await query.fetch(defaultedOptions)
+ : (query.state.data as TQueryData)
376
377
const select = defaultedOptions.select
378
379
if (select) {
380
- return basePromise.then((data) => select(data))
+ return select(queryData)
381
}
382
383
- return basePromise.then((data) => data as unknown as TData)
+ return queryData as unknown as TData
384
385
386
fetchQuery<
0 commit comments