import type { ReactNode } from 'react'; import { combineElements, isImmutableElement } from './client-utils/element-etags.js'; import type { FetchRsc, RscEnhancer } from './client-utils/root-store.js'; import type { RegisterRscReloadListener } from './client-utils/rsc-reload.js'; export { hasRenderCancellationDigest } from '../lib/utils-isomorphic/render-cancellation.js'; export { formatRscUrl } from '../lib/utils-isomorphic/rsc-path.js'; export { combineElements, isImmutableElement }; type Elements = Readonly>; /** * Recognizes the rejection of an RSC fetch whose response comes from a * different build, such as a newer deploy. Reload the page to recover. */ export declare function isBuildIdMismatch(error: unknown): boolean; export declare const createBuildIdMismatchForTest: () => Error; export declare function callServerRsc(serverFunctionId: string, args: unknown[]): Promise; type MergeElements = (elements: Elements | Promise, merge?: (previous: Promise, incoming: Promise) => Promise) => Promise; /** * Returns the fetch of the enclosing `Root_UNSTABLE`, which runs that Root's * enhancers and returns response entries without merging them into the Root or * `unstable_base`. Omitted slots must be retained by the caller. Outside a Root * it runs no enhancers. */ export declare function useFetchRsc(): FetchRsc; /** * Returns a function that merges an element record or its promise into the * enclosing Root. Returns the incoming payload without waiting for the merge * or render, or rejects on failure. A rejected ordinary merge leaves the * current elements unchanged. * A custom merge receives the latest queued element promise and the incoming * promise with rejected payloads recovered to an empty record. It returns the * replacement promise, or the previous promise to leave the Root unchanged. * The callback must be pure; results are memoized for React's updater replay. * Use `startTransition` to retain visible content while this or an earlier * queued update is pending; urgent merges can show a Suspense fallback. */ export declare function useMergeElements(): MergeElements; /** * Returns a Root-bound registrar for development RSC reload listeners. The * registrar is a no-op in production. Listeners coexist by default. With * `replace`, the listener owns the Root's active refetch target until it is * replaced or unregistered. */ export declare function useRegisterRscReloadListener(): RegisterRscReloadListener; /** * Client root. Seeds the initial elements, bridges the store to React state, * and provides the elements to `Slot` descendants. */ export declare function Root({ initialRscPath, initialRscParams, rscEnhancers, children, }: { initialRscPath?: string; initialRscParams?: unknown; /** * Initial pipeline, copied for this mount; the last enhancer is outermost. * Keep the array reference stable across renders, including initial Suspense * retries. Remount with a new array to change the pipeline. * Client bootstrap fetches use it; streamed initial payloads bypass it. */ rscEnhancers?: readonly RscEnhancer[]; children: ReactNode; }): import("react").JSX.Element; /** Render the client children passed to the enclosing Slot. */ export declare function Children(): ReactNode; /** * Returns the enclosing Root's read-only element-map promise. Reading it with * React's `use` suspends while the record is pending. */ export declare function useElementsPromise(): Promise>>; /** * Slot component * This is used under the Root component. * Slot id is the key of elements returned by the server. * * If the server returns this * ``` * { 'foo':
foo
, 'bar':
bar
} * ``` * then you can use this component like this * ``` * * ``` */ export declare function Slot({ id, children }: { id: string; children?: ReactNode; }): import("react").JSX.Element; export declare function INTERNAL_ServerRoot({ elementsPromise, children, }: { elementsPromise: Promise; children: ReactNode; }): import("react").JSX.Element;