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