Skip to content

Ensure static pages get prerendered when SSR is disabled #11639

@benmccann

Description

@benmccann

Describe the problem

People enable SPA without prerendering and their sites are much slower as a result because it results in an extra round trip to the server before anything can be rendered. I found tons of examples of this in the wild. E.g. appwrite/console#722

Describe the proposed solution

Check if fetch is called. If it's not, then automatically prerender the page even if prerender = true is not set

For this to work, pages would need to be crawled and rendered even if prerender = true is not set, which I think is the case today though I'm not certain

We'll also need to add an isStatic check to the adapter and do it only when true so that we don't have to worry about losing headers.

Alternatives considered

  • Deprecate SPA mode. It's often used as a shortcut rather than addressing issues when they're hit. People just opt out of SSR as a quick and dirty fix, but users suffer for it. However, it can ease deployment to hosts that offer static deployment, so this may be a bit of a drastic measure
  • Tell users to turn on prerendering in cases where fetch is not called, SSR is disabled, and prerendering is not enabled. We could either throw an error or log a big nasty warning rather than just automatically prerendering the page

Importance

nice to have

Additional Information

No response

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