UseInfiniteFetchOptionsType
import { UseInfiniteFetchOptionsType } from "@hyper-fetch/react"
Preview
type UseInfiniteFetchOptionsType<R,P,TSelected> = {
bounce?: boolean;
bounceTime?: number;
bounceTimeout?: number;
bounceType?: debounce | throttle;
dependencies?: any[];
dependencyTracking?: boolean;
disabled?: boolean;
keepPreviousData?: auto | preserve | clean;
maxPages?: number;
pagination: P;
refetchBlurred?: boolean;
refetchOnBlur?: boolean;
refetchOnFocus?: boolean;
refetchOnReconnect?: boolean;
refresh?: boolean;
refreshTime?: number;
revalidate?: boolean;
select?: (context: { items: PaginationItem<R, P>[]; pages: ExtractResponseType<R>[] }) => TSelected;
structuralSharing?: boolean;
suspense?: boolean;
throwOnError?: boolean | (error: ExtractErrorType<R>) => boolean;
uniqueBy?: Extract<keyof PaginationItem<R, P>, string> | (context: { item: PaginationItem<R, P> }) => unknown;
}
Structure
| Name | Type | Description |
|---|---|---|
| bounce | | Waits for the request to settle before starting a new list, for filters changing while typing |
| bounceTime | | How long new lists are bounced |
| bounceTimeout | | Only for the throttle strategy - handling of the last bounce event |
| bounceType | | Bounce strategy |
| dependencies | | Refetches the loaded pages when any of these values change |
| dependencyTracking | | Rerenders only when the values used by the component change |
| disabled | | Disables fetching |
| keepPreviousData | | What is shown while a new list loads its first page:
|
| maxPages | | Keeps only this many pages loaded. Pages at the opposite end are dropped and can be fetched again. |
| pagination | | Which fields of the request page through the list. Every key is checked against the request types. |
| refetchBlurred | | Keeps refreshing while the tab is not focused |
| refetchOnBlur | | Refetches when the user leaves the tab |
| refetchOnFocus | | Refetches when the user enters the tab |
| refetchOnReconnect | | Refetches when the network is restored |
| refresh | | Refetches the loaded pages on an interval |
| refreshTime | | Refresh interval time |
| revalidate | | Refetches pages restored from the cache on mount, even when they are not stale yet |
| structuralSharing | | Keeps references of the unchanged parts of the list between updates |
| suspense | | Suspends until the first page arrives. Later pages never suspend. |
| throwOnError | | Throws the error to the closest Error Boundary once the page request settles. Pass a function to decide per error. |
| uniqueBy | | Drops items repeated across pages, for lists that shift while scrolling. Name a field of the item or return the identity from a function. |
| select | | Transforms the list used by the component. The cache stays shared with other hooks. |

