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 b602b65 commit a7246a6Copy full SHA for a7246a6
packages/toolkit/src/query/react/buildHooks.ts
@@ -1340,7 +1340,10 @@ export function buildHooks<Definitions extends EndpointDefinitions>({
1340
// isFetching = true any time a request is in flight
1341
const isFetching = currentState.isLoading
1342
// isLoading = true only when loading while no data is present yet (initial load with no data in the cache)
1343
- const isLoading = !hasData && isFetching
+ const isLoading =
1344
+ (!lastResult || lastResult.isLoading || lastResult.isUninitialized) &&
1345
+ !hasData &&
1346
+ isFetching
1347
// isSuccess = true when data is present
1348
const isSuccess = currentState.isSuccess || (isFetching && hasData)
1349
0 commit comments