import { type ReactNode, type ComponentType } from "react"; import type { ResolvedSegment, RootLayoutProps } from "./types.js"; /** * Options for renderSegments */ export interface RenderSegmentsOptions { /** * If true, this render is for a server action response. * In browser during actions, we await component promises to prevent * UI flickering/suspense during optimistic updates. */ isAction?: boolean; /** * If true, force awaiting all loaders instead of streaming with Suspense. * Used for popstate (back/forward) navigation where we want instant rendering * from cache without showing loading skeletons. */ forceAwait?: boolean; /** * Intercept segments to inject into the tree. * These are parallel segments from intercept routes that need to be * associated with their parent layout's named outlet. * * Passed separately for explicit handling - makes the flow clearer * and easier to debug than relying on ID pattern matching. */ interceptSegments?: ResolvedSegment[]; /** * Root layout component that wraps the entire application. * When provided, wraps both route content and the error boundary, * preventing the app shell from unmounting during errors (avoids FOUC). */ rootLayout?: ComponentType; } /** * Render segments into a React tree with proper layout nesting * * Layouts nest using OutletProvider, while route + parallel + error + notFound segments * render as siblings in a Fragment. * * Error segments are treated like route segments - they render their fallback * component in place of the failed segment. When an error occurs in a handler, * loader, or middleware, the router creates an error segment with the nearest * error boundary's fallback component. * * NotFound segments are similar to error segments but are triggered by * DataNotFoundError (thrown via notFound()). They render the nearest * notFoundBoundary's fallback component. * * @param segments - Array of resolved segments to render * @returns ReactNode representing the component tree * * @example * ```typescript * const segments = [ * { id: 'L0.0', type: 'layout', component: }, * { id: 'L1.0', type: 'layout', component: }, * { id: 'R2.0', type: 'route', component: }, * { id: 'P3.0', type: 'parallel', component: , slot: '@sidebar' } * ]; * * const tree = renderSegments(segments); * // Results in: * // * // * // <> * // * // * * // For server actions, pass isAction to await components: * const tree = renderSegments(segments, { isAction: true }); * ``` */ export declare function renderSegments(segments: ResolvedSegment[], options?: RenderSegmentsOptions): Promise; //# sourceMappingURL=segment-system.d.ts.map