( data: TData | undefined, options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>, )
| 708 | } |
| 709 | |
| 710 | export function fetchState< |
| 711 | TQueryFnData, |
| 712 | TError, |
| 713 | TData, |
| 714 | TQueryKey extends QueryKey, |
| 715 | >( |
| 716 | data: TData | undefined, |
| 717 | options: QueryOptions<TQueryFnData, TError, TData, TQueryKey>, |
| 718 | ) { |
| 719 | return { |
| 720 | fetchFailureCount: 0, |
| 721 | fetchFailureReason: null, |
| 722 | fetchStatus: canFetch(options.networkMode) ? 'fetching' : 'paused', |
| 723 | ...(data === undefined && |
| 724 | ({ |
| 725 | error: null, |
| 726 | status: 'pending', |
| 727 | } as const)), |
| 728 | } as const |
| 729 | } |
| 730 | |
| 731 | function successState<TData>(data: TData | undefined, dataUpdatedAt?: number) { |
| 732 | return { |
no test coverage detected