import type { ArgsOrVoidOrSkip, IResource, IResourceAgent } from "../../query/types/index.js"; /** * The agent behind `useResource` / `useSuspenseResource`: one agent per * `(resource, args key)`, created during render and started after commit. * * Render stays pure on purpose. Mutating a single long-lived agent from render * (`agent.set(args)`) is a side effect on a store shared by every render of the * component — including the concurrent ones React keeps in flight at the same * time. With an args change inside a transition, the transition render pushes * the new args into the store, the store notifies, React synchronously * re-renders the *committed* tree (still on the old args), which pushes the old * args back, and so on until the transition times out. A fresh agent per args * gives every render lane its own object: nothing is shared, nothing loops. * * SWR across an args change is preserved by handing the stale data over from * the last committed agent to its successor (`adoptPrevious`). The handoff * source is a ref written in the layout effect, so a discarded render never * leaks into the committed tree and a successor always continues from what is * actually on screen. * * @param startDuringRender - Start the query when the agent is created (the * Suspense hook: a suspended render aborts its effects, so a deferred start * would leave the fallback hanging forever). Otherwise the query starts in a * layout effect, once the render is committed. */ export declare function useResourceAgent(resource: IResource, args: ArgsOrVoidOrSkip, startDuringRender: boolean): IResourceAgent;