/** * The async-cell engine behind `useData` — the client state machine for one * keyed read: key changes, in-flight dedupe, supersede, refresh, and the * SSR-blob restore/writeback cycle. * * Pinned semantics (docs/rfc-async.md rev 8): * - key change ⇒ hard reset: value cleared, state 'pending' (no wrong-data flash) * - same-key refresh() ⇒ value kept, state 'refreshing' * - a superseded run NEVER writes state or `.error` * - the underlying fetch is aborted only when this cell was its sole consumer * - `refresh()` never rejects — failures land on `.error` */ import type { ComponentSetupContext } from '../component-types.js'; import { type AsyncFetcherContext, type AsyncState } from './shared.js'; /** * Refresh every mounted `useData` cell whose canonical key matches any of * `patterns`, and drop the matching entries from the SSR transfer blob. * * Both halves matter. Refreshing the mounted cells is the visible effect; the * blob sweep is what stops a stale value coming BACK. `startRun` writes every * successful fetch into `__SIGX_ASYNC__`, and `setKey` restores from it as * `ready` without fetching — so an invalidation that skipped the blob would be * undone by the next unmount/remount (a client-side navigation away and back), * with no refetch at all, until a full page load. * * ONE fetch per key, not one per cell: several components can read the same * key (that is what the `inflight` dedupe above is for), and `refresh()` * FORCES — it drops the shared in-flight entry so the next acquire starts a * new run. Having every cell force would make N mounted readers issue N * requests and leave all but the last observing a superseded one. So the first * cell on a key forces, and the rest join the run it just started. * * Returns the number of keys touched, so a caller can dev-warn when a pattern * matched nothing (a silent no-op is how #484 stayed invisible for so long). * * @internal */ export declare function invalidateKeys(patterns: ReadonlyArray): number; /** @internal — engine handle returned to `useData` (the `cell` is the public object). */ export interface DataCellHandle { cell: AsyncState; /** Point the cell at a (canonical) key — `null` means skip ⇒ 'idle'. */ setKey(canon: string | null, raw: unknown): void; /** Stop observing: supersede any in-flight run and drop the fetch ref. */ dispose(): void; } /** * Create the reactive cell for one `useData` call. `instance` is the * setup-time component context — captured for unhandled-error bubbling. * * @internal */ export declare function createDataCell(fetcher: (arg: unknown, ctx: AsyncFetcherContext) => Promise, instance: ComponentSetupContext | null): DataCellHandle; /** * The shared skip cell: `state 'idle'`, nothing to fetch, `refresh()` is a * resolved no-op. Returned when a key resolves falsy on the provider (SSR) * path — the client path keeps a live cell so the key can turn truthy later. * * @internal */ export declare const INERT_IDLE_CELL: AsyncState; //# sourceMappingURL=cell.d.ts.map