@tanstack/query-core 4.7.2 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/queryObserver.esm.js +9 -6
- package/build/lib/queryObserver.esm.js.map +1 -1
- package/build/lib/queryObserver.js +9 -6
- package/build/lib/queryObserver.js.map +1 -1
- package/build/lib/queryObserver.mjs +9 -6
- package/build/lib/queryObserver.mjs.map +1 -1
- package/build/lib/types.d.ts +1 -0
- package/build/umd/index.development.js +9 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/queryObserver.ts +9 -6
- package/src/types.ts +1 -0
package/package.json
CHANGED
package/src/queryObserver.ts
CHANGED
|
@@ -547,13 +547,16 @@ export class QueryObserver<
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
const isFetching = fetchStatus === 'fetching'
|
|
550
|
+
const isLoading = status === 'loading'
|
|
551
|
+
const isError = status === 'error'
|
|
550
552
|
|
|
551
553
|
const result: QueryObserverBaseResult<TData, TError> = {
|
|
552
554
|
status,
|
|
553
555
|
fetchStatus,
|
|
554
|
-
isLoading
|
|
556
|
+
isLoading,
|
|
555
557
|
isSuccess: status === 'success',
|
|
556
|
-
isError
|
|
558
|
+
isError,
|
|
559
|
+
isInitialLoading: isLoading && isFetching,
|
|
557
560
|
data,
|
|
558
561
|
dataUpdatedAt,
|
|
559
562
|
error,
|
|
@@ -564,13 +567,13 @@ export class QueryObserver<
|
|
|
564
567
|
isFetchedAfterMount:
|
|
565
568
|
state.dataUpdateCount > queryInitialState.dataUpdateCount ||
|
|
566
569
|
state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
567
|
-
isFetching
|
|
568
|
-
isRefetching: isFetching &&
|
|
569
|
-
isLoadingError:
|
|
570
|
+
isFetching,
|
|
571
|
+
isRefetching: isFetching && !isLoading,
|
|
572
|
+
isLoadingError: isError && state.dataUpdatedAt === 0,
|
|
570
573
|
isPaused: fetchStatus === 'paused',
|
|
571
574
|
isPlaceholderData,
|
|
572
575
|
isPreviousData,
|
|
573
|
-
isRefetchError:
|
|
576
|
+
isRefetchError: isError && state.dataUpdatedAt !== 0,
|
|
574
577
|
isStale: isStale(query, options),
|
|
575
578
|
refetch: this.refetch,
|
|
576
579
|
remove: this.remove,
|
package/src/types.ts
CHANGED
|
@@ -373,6 +373,7 @@ export interface QueryObserverBaseResult<TData = unknown, TError = unknown> {
|
|
|
373
373
|
isFetching: boolean
|
|
374
374
|
isLoading: boolean
|
|
375
375
|
isLoadingError: boolean
|
|
376
|
+
isInitialLoading: boolean
|
|
376
377
|
isPaused: boolean
|
|
377
378
|
isPlaceholderData: boolean
|
|
378
379
|
isPreviousData: boolean
|