Skip to content

Prerenders in SPA mode only render the root route #4798

Closed

Description

@svemat01

Which project does this relate to?

Start

Describe the bug

In SPA mode, prerendering additional pages doesn't result in html files with their proper content. Only the root route gets rendered resulting in essentially useless prerendered file since they serve no additional purpose over the normal _shell.html file

Your Example Website or App

https://github.com/TanStack/router/tree/main/examples/react/start-basic-static

Steps to Reproduce the Bug or Issue

  1. Run build
  2. Check one of the html files (For example route-a.html)
  3. Notice that it only contains content from the root route and not it's own content <div>I'm A!</div>

Expected behavior

I'd expect the prerendering to function as normal (without spa mode) where the full route/page is prerendered and not just the root route.

Screenshots or Videos

No response

Platform

As seen in example start-basic-static at the time of making this issue

  • Router / Start Version: 1.130.1
  • OS: macOS
  • Bundler: vite
  • Bundler Version: 6.3.5

Additional context

Discord thread between me and Manuel Schiller. (Mostly discussion around the issue)
Notable comments in the thread from Manuel:

we need to distinguish prerendering for shell generation and actual prerendering
right now that's treated the same

The issue likely stems from this line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions