Skip to content
Source
Sign inSign up
TanStack/router

fix: filter out routes from manifest that have neither preloads nor a… #5596

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5596/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

…ssets

Summary by CodeRabbit

  • Performance
    • Optimized route tree pruning to remove routes without assets or preloads
    • Streamlined manifest to exclude empty or undefined route entries
    1. Walkthrough

      The pull request modifies internal route filtering logic in the manifest generation pipeline. Routes without assets or preloads are pruned from the route tree, and the manifest shape is refined to conditionally include only present preloads and assets fields, avoiding undefined values in the output.

      Changes

      Cohort / File(s)Summary
      Manifest route pruning and filtering logic
      packages/start-plugin-core/src/start-manifest-plugin/plugin.ts, packages/start-server-core/src/router-manifest.ts
      Post-processes route tree to remove routes lacking assets or preloads. Refines per-route mapping to conditionally attach preloads and assets only when present, using type-annotated accumulator and constraining assets type to Array. Eliminates undefined fields from manifest entries.

      Estimated code review effort

      🎯 2 (Simple) | ⏱️ ~10 minutes

      Suggested labels

      package: start-plugin-core

      Poem

      🐰 Routes stripped of burden, lean and clean, Only the essential now is seen, Assets dance with preloads true, No undefined fields break through! Manifest trimmed to shining bright.

      Pre-merge checks and finishing touches

      ❌ Failed checks (1 warning)
      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring coverage is 50.00% which is insufficient. The required threshold is 80.00%.You can run @coderabbitai generate docstrings to improve docstring coverage.
      ✅ Passed checks (2 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title Check✅ PassedThe pull request title "fix: filter out routes from manifest that have neither preloads nor assets" directly and accurately describes the main change implemented across both modified files. The changes add a post-processing step to prune routes that lack both preloads and assets from the manifest in start-manifest-plugin/plugin.ts, and modify the route mapping logic in router-manifest.ts to conditionally include these fields only when present. The title is concise, uses a specific verb ("filter out"), clearly identifies what is being modified ("routes from manifest"), and specifies the filtering criteria ("neither preloads nor assets"). This is exactly the type of clear, actionable summary that helps developers understand the primary change without ambiguity.
      ✨ Finishing touches
      • 📝 Generate docstrings
        🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `filter-routes-manifest`

      📜 Recent review details

      Configuration used: CodeRabbit UI

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 2c90c0cca2b7e49b4c240174a37838f7f8df2d49 and 9a524c6ca0ae573e8a90172b2f7444949764ead9.

      📒 Files selected for processing (2)
      • packages/start-plugin-core/src/start-manifest-plugin/plugin.ts (1 hunks)
      • packages/start-server-core/src/router-manifest.ts (2 hunks)
      🧰 Additional context used
      📓 Path-based instructions (2)
      **/*.{ts,tsx}

      📄 CodeRabbit inference engine (AGENTS.md)

      Use TypeScript in strict mode with extensive type safety across the codebase

      Files:

      • packages/start-plugin-core/src/start-manifest-plugin/plugin.ts
      • packages/start-server-core/src/router-manifest.ts
      packages/{*-start,start-*}/**

      📄 CodeRabbit inference engine (AGENTS.md)

      Name and place Start framework packages under packages/-start/ or packages/start-/

      Files:

      • packages/start-plugin-core/src/start-manifest-plugin/plugin.ts
      • packages/start-server-core/src/router-manifest.ts
      🧬 Code graph analysis (1)
      packages/start-server-core/src/router-manifest.ts (3)
      packages/router-core/src/index.ts (1)
      • RouterManagedTag (73-73)
      packages/react-router/src/index.tsx (1)
      • RouterManagedTag (82-82)
      packages/solid-router/src/index.tsx (1)
      • RouterManagedTag (81-81)
      🔇 Additional comments (3)
      packages/start-server-core/src/router-manifest.ts (2)

      4-4: LGTM! Type import properly added.

      The RouterManagedTag import is correctly used in the type annotation at line 49.


      47-57: LGTM! Cleaner manifest structure with conditional field inclusion.

      The refactor correctly builds a result object that only includes preloads and assets when they are present, avoiding undefined values in the manifest. The explicit type annotation ensures type safety, and the logic aligns with the route filtering in packages/start-plugin-core/src/start-manifest-plugin/plugin.ts.

      packages/start-plugin-core/src/start-manifest-plugin/plugin.ts (1)

      247-255: LGTM! Clean filtering logic. Verified that downstream usage is safe.

      The filtering correctly removes routes without assets or preloads. Downstream code either iterates existing manifest entries (Object.entries()) or uses optional chaining when accessing specific routes—both patterns safely handle filtered-out routes. The root route is protected by guaranteed preloads/assets assignments.


      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-server-core

    4. View your CI Pipeline Execution ↗ for commit 9a524c6ca0ae573e8a90172b2f7444949764ead9

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded4m 53sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 22sView ↗

      ☁️ Nx Cloud last updated this comment at 2025-10-23 23:35:03 UTC

    5. More templates

      @tanstack/arktype-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5596

      @tanstack/directive-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5596

      @tanstack/eslint-plugin-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5596

      @tanstack/history

      npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5596

      @tanstack/nitro-v2-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5596

      @tanstack/react-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5596

      @tanstack/react-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5596

      @tanstack/react-router-ssr-query

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5596

      @tanstack/react-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5596

      @tanstack/react-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5596

      @tanstack/react-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5596

      @tanstack/router-cli

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5596

      @tanstack/router-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5596

      @tanstack/router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5596

      @tanstack/router-devtools-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5596

      @tanstack/router-generator

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5596

      @tanstack/router-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5596

      @tanstack/router-ssr-query-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5596

      @tanstack/router-utils

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5596

      @tanstack/router-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5596

      @tanstack/server-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5596

      @tanstack/solid-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5596

      @tanstack/solid-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5596

      @tanstack/solid-router-ssr-query

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5596

      @tanstack/solid-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5596

      @tanstack/solid-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5596

      @tanstack/solid-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5596

      @tanstack/start-client-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5596

      @tanstack/start-plugin-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5596

      @tanstack/start-server-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5596

      @tanstack/start-static-server-functions

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5596

      @tanstack/start-storage-context

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5596

      @tanstack/valibot-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5596

      @tanstack/virtual-file-routes

      npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5596

      @tanstack/zod-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5596

      commit: 9a524c6

Sign in to join this conversation.