@tanstack/query-core 4.7.2 → 4.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-core",
3
- "version": "4.7.2",
3
+ "version": "4.9.0",
4
4
  "description": "TODO",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -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: status === 'loading',
556
+ isLoading,
555
557
  isSuccess: status === 'success',
556
- isError: status === 'error',
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: isFetching,
568
- isRefetching: isFetching && status !== 'loading',
569
- isLoadingError: status === 'error' && state.dataUpdatedAt === 0,
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: status === 'error' && state.dataUpdatedAt !== 0,
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