import { type Dispatch, type SetStateAction } from 'react'; export interface UseSelfFetchResult { data: T | null; /** Imperatively patch the fetched data (e.g. optimistic vote updates). */ setData: Dispatch>; isLoading: boolean; error: boolean; /** Re-run the fetch (error-retry affordance). */ reload: () => void; } /** * The single source for the 4 self-fetching content views * (`ProductReleasesView`, `RoadmapView`, the onboarding catalog/detail). GETs a * configured `url` into component state with **plain `fetch` + `useEffect`** — * deliberately NO react-query, so embedders don't need a QueryClient. This is * the same technology choice the shipped `DeliveryLists` makes; that component * predates this hook and still hand-rolls the loop (a future pass can migrate * it onto a two-url variant of this hook). * * Behaviour: * - `url = null` → fetching is DISABLED (controlled / SSR mode, or missing * config); returns `initialData ?? null` and never fetches. * - `initialData` provided → hydrates immediately and SKIPS the first fetch * (so the hub's server-rendered data isn't re-fetched on mount); later * `url` changes still re-fetch. * - a `cancelled` guard ensures an in-flight response from a STALE `url` * (e.g. a fast pagination / section toggle) can't overwrite a newer one. * - `reload()` bumps an internal key to retry after an error. * - `revalidateOnVisibleAfterMs` (opt-in) → re-fetch when the tab becomes * visible AND the held data is older than the threshold. Event-driven * freshness with ZERO background requests — the replacement for * setInterval polling. Data age counts from the last completed fetch, or * from mount when `initialData` seeded it (an SSR seed is milliseconds * old — without that, the first refocus would always refire). * * Re-fetches whenever `url` changes, so callers fold all query params INTO the * url string (the url IS the cache key). */ export declare function useSelfFetch(url: string | null, options?: { initialData?: T; revalidateOnVisibleAfterMs?: number; }): UseSelfFetchResult; //# sourceMappingURL=use-self-fetch.d.ts.map