{"version":3,"sources":["../../../src/server/app-render/walk-tree-with-flight-router-state.tsx"],"sourcesContent":["import type {\n  FlightDataPath,\n  FlightDataSegment,\n  FlightRouterState,\n  PrefetchHints,\n  Segment,\n  HeadData,\n} from '../../shared/lib/app-router-types'\nimport type { PreloadCallbacks } from './types'\nimport { matchSegment } from '../../client/components/match-segments'\nimport type { LoaderTree } from '../lib/app-dir-module'\nimport { getLinkAndScriptTags } from './get-css-inlined-link-tags'\nimport { getPreloadableFonts } from './get-preloadable-fonts'\nimport {\n  createFlightRouterStateFromLoaderTree,\n  createRouteTreePrefetch,\n} from './create-flight-router-state-from-loader-tree'\nimport type { AppRenderContext } from './app-render'\nimport { hasLoadingComponentInTree } from './has-loading-component-in-tree'\nimport { addSearchParamsIfPageSegment } from '../../shared/lib/segment'\nimport { createComponentTree } from './create-component-tree'\nimport { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param'\n\n/**\n * Use router state to decide at what common layout to render the page.\n * This can either be the common layout between two pages or a specific place to start rendering from using the \"refetch\" marker in the tree.\n */\nexport async function walkTreeWithFlightRouterState({\n  loaderTreeToFilter,\n  parentParams,\n  flightRouterState,\n  parentIsInsideSharedLayout,\n  rscHead,\n  injectedCSS,\n  injectedJS,\n  injectedFontPreloadTags,\n  rootLayoutIncluded,\n  ctx,\n  preloadCallbacks,\n  MetadataOutlet,\n  hintTree,\n}: {\n  loaderTreeToFilter: LoaderTree\n  parentParams: { [key: string]: string | string[] }\n  flightRouterState?: FlightRouterState\n  rscHead: HeadData\n  parentIsInsideSharedLayout?: boolean\n  injectedCSS: Set<string>\n  injectedJS: Set<string>\n  injectedFontPreloadTags: Set<string>\n  rootLayoutIncluded: boolean\n  ctx: AppRenderContext\n  preloadCallbacks: PreloadCallbacks\n  MetadataOutlet: React.ComponentType\n  hintTree: PrefetchHints | null\n}): Promise<FlightDataPath[]> {\n  const {\n    renderOpts: { nextFontManifest, experimental },\n    query,\n    isPrefetch,\n    getDynamicParamFromSegment,\n    parsedRequestHeaders,\n    workStore,\n  } = ctx\n  const prefetchInliningEnabled = Boolean(experimental.prefetchInlining)\n  const cacheComponents = ctx.renderOpts.cacheComponents\n  const partialPrefetching = ctx.renderOpts.partialPrefetching\n  const isStaticGeneration = workStore.isStaticGeneration\n  const isBuildTimePrerendering =\n    ctx.renderOpts.isBuildTimePrerendering ?? false\n\n  const [segment, parallelRoutes, modules] = loaderTreeToFilter\n\n  const parallelRoutesKeys = Object.keys(parallelRoutes)\n\n  const { layout } = modules\n  const isLayout = typeof layout !== 'undefined'\n\n  /**\n   * Checks if the current segment is a root layout.\n   */\n  const rootLayoutAtThisLevel = isLayout && !rootLayoutIncluded\n  /**\n   * Checks if the current segment or any level above it has a root layout.\n   */\n  const rootLayoutIncludedAtThisLevelOrAbove =\n    rootLayoutIncluded || rootLayoutAtThisLevel\n\n  // Because this function walks to a deeper point in the tree to start rendering we have to track the dynamic parameters up to the point where rendering starts\n  const segmentParam = getDynamicParamFromSegment(loaderTreeToFilter)\n  const currentParams =\n    // Handle null case where dynamic param is optional\n    segmentParam && segmentParam.value !== null\n      ? {\n          ...parentParams,\n          [segmentParam.param]: segmentParam.value,\n        }\n      : parentParams\n  const actualSegment: Segment = addSearchParamsIfPageSegment(\n    segmentParam ? segmentParam.treeSegment : segment,\n    query\n  )\n\n  /**\n   * Decide if the current segment is where rendering has to start.\n   */\n  const renderComponentsOnThisLevel =\n    // No further router state available\n    !flightRouterState ||\n    // Segment in router state does not match current segment\n    !matchSegment(actualSegment, flightRouterState[0]) ||\n    // Explicit refresh\n    flightRouterState[3] === 'refetch'\n\n  // Pre-PPR, the `loading` component signals to the router how deep to render the component tree\n  // to ensure prefetches are quick and inexpensive. If there's no `loading` component anywhere in the tree being rendered,\n  // the prefetch will be short-circuited to avoid requesting a potentially very expensive subtree. If there's a `loading`\n  // somewhere in the tree, we'll recursively render the component tree up until we encounter that loading component, and then stop.\n\n  // Check if we're inside the \"new\" part of the navigation — inside the\n  // shared layout. In the case of a prefetch, this can be true even if the\n  // segment matches, because the client might send a matching segment to\n  // indicate that it already has the data in its cache. But in order to find\n  // the correct loading boundary, we still need to track where the shared\n  // layout begins.\n  //\n  // TODO: We should rethink the protocol for dynamic requests. It might not\n  // make sense for the client to send a FlightRouterState, since that type is\n  // overloaded with other concerns.\n  const isInsideSharedLayout =\n    renderComponentsOnThisLevel ||\n    parentIsInsideSharedLayout ||\n    flightRouterState[3] === 'inside-shared-layout'\n\n  if (\n    isInsideSharedLayout &&\n    !experimental.isRoutePPREnabled &&\n    // If PPR is disabled, and this is a request for the route tree, then we\n    // never render any components. Only send the router state.\n    (parsedRequestHeaders.isRouteTreePrefetchRequest ||\n      // Otherwise, check for the presence of a `loading` component.\n      (isPrefetch &&\n        !Boolean(modules.loading) &&\n        !hasLoadingComponentInTree(loaderTreeToFilter)))\n  ) {\n    // Send only the router state.\n    // TODO: Even for a dynamic route, we should cache these responses,\n    // because they do not contain any render data (neither segment data nor\n    // the head). They can be made even more cacheable once we move the route\n    // params into a separate data structure.\n    const overriddenSegment =\n      flightRouterState &&\n      // TODO: Why does canSegmentBeOverridden exist? Why don't we always just\n      // use `actualSegment`? Is it to avoid overwriting some state that's\n      // tracked by the client? Dig deeper to see if we can simplify this.\n      canSegmentBeOverridden(actualSegment, flightRouterState[0])\n        ? flightRouterState[0]\n        : actualSegment\n\n    const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest\n      ? // Route tree prefetch requests contain some extra information\n        await createRouteTreePrefetch(\n          loaderTreeToFilter,\n          hintTree,\n          prefetchInliningEnabled,\n          cacheComponents,\n          partialPrefetching,\n          isStaticGeneration,\n          isBuildTimePrerendering,\n          getDynamicParamFromSegment,\n          rootLayoutIncluded\n        )\n      : await createFlightRouterStateFromLoaderTree(\n          loaderTreeToFilter,\n          hintTree,\n          prefetchInliningEnabled,\n          cacheComponents,\n          partialPrefetching,\n          isStaticGeneration,\n          isBuildTimePrerendering,\n          getDynamicParamFromSegment,\n          query,\n          rootLayoutIncluded\n        )\n\n    return [\n      [\n        overriddenSegment,\n        routerState,\n        null,\n        [null, null],\n        true,\n      ] satisfies FlightDataSegment,\n    ]\n  }\n\n  // Similar to the previous branch. This flag is sent by the client to request\n  // only the metadata for a page. No segment data.\n  if (flightRouterState && flightRouterState[3] === 'metadata-only') {\n    const overriddenSegment =\n      flightRouterState &&\n      canSegmentBeOverridden(actualSegment, flightRouterState[0])\n        ? flightRouterState[0]\n        : actualSegment\n    const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest\n      ? await createRouteTreePrefetch(\n          loaderTreeToFilter,\n          hintTree,\n          prefetchInliningEnabled,\n          cacheComponents,\n          partialPrefetching,\n          isStaticGeneration,\n          isBuildTimePrerendering,\n          getDynamicParamFromSegment\n        )\n      : await createFlightRouterStateFromLoaderTree(\n          loaderTreeToFilter,\n          hintTree,\n          prefetchInliningEnabled,\n          cacheComponents,\n          partialPrefetching,\n          isStaticGeneration,\n          isBuildTimePrerendering,\n          getDynamicParamFromSegment,\n          query,\n          rootLayoutIncluded\n        )\n    return [\n      [\n        overriddenSegment,\n        routerState,\n        null,\n        rscHead,\n        false,\n      ] satisfies FlightDataSegment,\n    ]\n  }\n\n  if (renderComponentsOnThisLevel) {\n    const overriddenSegment =\n      flightRouterState &&\n      // TODO: Why does canSegmentBeOverridden exist? Why don't we always just\n      // use `actualSegment`? Is it to avoid overwriting some state that's\n      // tracked by the client? Dig deeper to see if we can simplify this.\n      canSegmentBeOverridden(actualSegment, flightRouterState[0])\n        ? flightRouterState[0]\n        : actualSegment\n\n    const routerState = await createFlightRouterStateFromLoaderTree(\n      // Create router state using the slice of the loaderTree\n      loaderTreeToFilter,\n      hintTree,\n      prefetchInliningEnabled,\n      cacheComponents,\n      partialPrefetching,\n      isStaticGeneration,\n      isBuildTimePrerendering,\n      getDynamicParamFromSegment,\n      query,\n      rootLayoutIncluded\n    )\n\n    // Create component tree using the slice of the loaderTree\n    const seedData = await createComponentTree(\n      // This ensures flightRouterPath is valid and filters down the tree\n      {\n        ctx,\n        loaderTree: loaderTreeToFilter,\n        parentParams: currentParams,\n        parentOptionalCatchAllParamName: null,\n        parentRuntimePrefetchable: false,\n        injectedCSS,\n        injectedJS,\n        injectedFontPreloadTags,\n        // This is intentionally not \"rootLayoutIncludedAtThisLevelOrAbove\" as createComponentTree starts at the current level and does a check for \"rootLayoutAtThisLevel\" too.\n        rootLayoutIncluded,\n        preloadCallbacks,\n        authInterrupts: experimental.authInterrupts,\n        MetadataOutlet,\n      }\n    )\n\n    return [\n      [\n        overriddenSegment,\n        routerState,\n        seedData,\n        rscHead,\n        false,\n      ] satisfies FlightDataSegment,\n    ]\n  }\n\n  // If we are not rendering on this level we need to check if the current\n  // segment has a layout. If so, we need to track all the used CSS to make\n  // the result consistent.\n  const layoutPath = layout?.[1]\n  const injectedCSSWithCurrentLayout = new Set(injectedCSS)\n  const injectedJSWithCurrentLayout = new Set(injectedJS)\n  const injectedFontPreloadTagsWithCurrentLayout = new Set(\n    injectedFontPreloadTags\n  )\n  if (layoutPath) {\n    getLinkAndScriptTags(\n      layoutPath,\n      injectedCSSWithCurrentLayout,\n      injectedJSWithCurrentLayout,\n      true\n    )\n    getPreloadableFonts(\n      nextFontManifest,\n      layoutPath,\n      injectedFontPreloadTagsWithCurrentLayout\n    )\n  }\n\n  const paths: FlightDataPath[] = []\n\n  // Walk through all parallel routes.\n  for (const parallelRouteKey of parallelRoutesKeys) {\n    const parallelRoute = parallelRoutes[parallelRouteKey]\n\n    const subPaths = await walkTreeWithFlightRouterState({\n      ctx,\n      loaderTreeToFilter: parallelRoute,\n      parentParams: currentParams,\n      flightRouterState:\n        flightRouterState && flightRouterState[1][parallelRouteKey],\n      parentIsInsideSharedLayout: isInsideSharedLayout,\n      rscHead,\n      injectedCSS: injectedCSSWithCurrentLayout,\n      injectedJS: injectedJSWithCurrentLayout,\n      injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout,\n      rootLayoutIncluded: rootLayoutIncludedAtThisLevelOrAbove,\n      preloadCallbacks,\n      MetadataOutlet,\n      hintTree: hintTree?.slots?.[parallelRouteKey] ?? null,\n    })\n\n    for (const subPath of subPaths) {\n      paths.push([actualSegment, parallelRouteKey, ...subPath])\n    }\n  }\n\n  return paths\n}\n\n/**\n * A simplified version of `walkTreeWithFlightRouterState` that doesn't skip any layouts\n * but returns a result of the same shape.\n * Intended to be used for instant validation, where we need the complete tree.\n */\nexport async function createFullTreeFlightDataForNavigation({\n  loaderTree,\n  rscHead,\n  injectedCSS,\n  injectedJS,\n  injectedFontPreloadTags,\n  ctx,\n  preloadCallbacks,\n  MetadataOutlet,\n}: {\n  loaderTree: LoaderTree\n  flightRouterState?: FlightRouterState\n  rscHead: HeadData\n  injectedCSS: Set<string>\n  injectedJS: Set<string>\n  injectedFontPreloadTags: Set<string>\n  ctx: AppRenderContext\n  preloadCallbacks: PreloadCallbacks\n  MetadataOutlet: React.ComponentType\n}): Promise<[rootSegment: FlightDataPath]> {\n  const {\n    renderOpts: { experimental },\n    query,\n    getDynamicParamFromSegment,\n    pagePath,\n    workStore: workStoreForInitialRender,\n  } = ctx\n\n  const hintTreeForInitialRender =\n    ctx.renderOpts.prefetchHints?.[pagePath] ?? null\n\n  const routerState = await createFlightRouterStateFromLoaderTree(\n    loaderTree,\n    hintTreeForInitialRender,\n    Boolean(experimental.prefetchInlining),\n    ctx.renderOpts.cacheComponents,\n    ctx.renderOpts.partialPrefetching,\n    workStoreForInitialRender.isStaticGeneration,\n    ctx.renderOpts.isBuildTimePrerendering ?? false,\n    getDynamicParamFromSegment,\n    query\n  )\n  const rootSegment = routerState[0]\n\n  const seedData = await createComponentTree({\n    ctx,\n    loaderTree,\n    parentParams: {},\n    parentOptionalCatchAllParamName: null,\n    parentRuntimePrefetchable: false,\n    injectedCSS,\n    injectedJS,\n    injectedFontPreloadTags,\n    rootLayoutIncluded: false,\n    preloadCallbacks,\n    authInterrupts: experimental.authInterrupts,\n    MetadataOutlet,\n  })\n\n  return [\n    [\n      // TODO: app-render slices this Segment off.\n      // why is that valid, and why are we including it in the first place?\n      rootSegment,\n      routerState,\n      seedData,\n      rscHead,\n      false,\n    ] satisfies FlightDataSegment,\n  ]\n}\n\n/*\n * This function is used to determine if an existing segment can be overridden\n * by the incoming segment.\n */\nconst canSegmentBeOverridden = (\n  existingSegment: Segment,\n  segment: Segment\n): boolean => {\n  if (Array.isArray(existingSegment) || !Array.isArray(segment)) {\n    return false\n  }\n\n  return getSegmentParam(existingSegment)?.paramName === segment[0]\n}\n"],"names":["createFullTreeFlightDataForNavigation","walkTreeWithFlightRouterState","loaderTreeToFilter","parentParams","flightRouterState","parentIsInsideSharedLayout","rscHead","injectedCSS","injectedJS","injectedFontPreloadTags","rootLayoutIncluded","ctx","preloadCallbacks","MetadataOutlet","hintTree","renderOpts","nextFontManifest","experimental","query","isPrefetch","getDynamicParamFromSegment","parsedRequestHeaders","workStore","prefetchInliningEnabled","Boolean","prefetchInlining","cacheComponents","partialPrefetching","isStaticGeneration","isBuildTimePrerendering","segment","parallelRoutes","modules","parallelRoutesKeys","Object","keys","layout","isLayout","rootLayoutAtThisLevel","rootLayoutIncludedAtThisLevelOrAbove","segmentParam","currentParams","value","param","actualSegment","addSearchParamsIfPageSegment","treeSegment","renderComponentsOnThisLevel","matchSegment","isInsideSharedLayout","isRoutePPREnabled","isRouteTreePrefetchRequest","loading","hasLoadingComponentInTree","overriddenSegment","canSegmentBeOverridden","routerState","createRouteTreePrefetch","createFlightRouterStateFromLoaderTree","seedData","createComponentTree","loaderTree","parentOptionalCatchAllParamName","parentRuntimePrefetchable","authInterrupts","layoutPath","injectedCSSWithCurrentLayout","Set","injectedJSWithCurrentLayout","injectedFontPreloadTagsWithCurrentLayout","getLinkAndScriptTags","getPreloadableFonts","paths","parallelRouteKey","parallelRoute","subPaths","slots","subPath","push","pagePath","workStoreForInitialRender","hintTreeForInitialRender","prefetchHints","rootSegment","existingSegment","getSegmentParam","Array","isArray","paramName"],"mappings":";;;;;;;;;;;;;;;IAgWsBA,qCAAqC;eAArCA;;IAr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