Ensure static pages get prerendered when SSR is disabled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
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. https://github.com/appwrite/console/issues/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
fetchis 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the SPA, SSR, prerendering, and adapter entry points, then determine how static pages are identified and whether fetch is called. Done means static pages are automatically prerendered when SSR is disabled and fetch is unused, while adapter handling preserves headers through an isStatic check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100