UNPKG

@vaadin/hilla-file-router

Version:

Hilla file-based router

19 lines (18 loc) 881 B
import type { RouteObject } from "react-router"; /** * Processes a tree of route objects and splits them into two separate trees: * - routes marked with {@link ViewConfiguration.skipLayout} flag that require * no layout rendering, * - regular routes that should render with their layouts. * * For routes with the {@link ViewConfiguration.skipLayout} flag, the layout * element is removed. The resulting routes are also marked with * {@link ViewConfiguration.ignoreFallback} flag to prevent rendering * server-side layouts for them. * * @param originalRoutes - The current route tree to process. * * @returns A new array containing reorganized routes with skipped routes first * (wrapped in an ignore-fallback container) followed by regular routes. */ export default function mergeSkipLayouts(originalRoutes: readonly RouteObject[] | undefined): readonly RouteObject[] | undefined;