utopia-php / utopia-php/detector

getAdapter() reports static for an SSR app that prerenders any route

Open
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3
Forks
0
Avg merge
11h 18m
Merged PRs (30d)
1

Description

Summary

TanStackStart::getAdapter() returns static for any config containing a prerender key, including nitro-based SSR apps that prerender a route or two and still need a running server.

Cause

src/Detection/Framework/TanStackStart.php:

if (!\preg_match('/\bprerender\b/', $stripped) || \preg_match('/\bprerender[\x27\x22]?\s*:\s*false\b/', $stripped)) {
    return 'ssr';
}

return 'static';

The presence of the token decides the answer. Prerendering a subset of routes is a partial-prerender SSR setup, not a static export — the server entry is still emitted and still required.

Reproduction

Against 0.2.6:

Config fragment Expected Actual
nitro({ prerender: { routes: ['/'], crawlLinks: true } }) ssr static
tanstackStart() ssr ssr
tanstackStart({ prerender: false }) ssr ssr
// we may prerender later ssr ssr

Comment stripping works correctly; the issue is only the subset case.

Real repository affected

jackytea/tanstack-startervite.config.ts registers tanstackStart() alongside nitro({ ... prerender: { routes: ['/'], crawlLinks: true } }). Its build emits .output/server/index.mjs, so it is an SSR app, but getAdapter() reports static.

Possible direction

A prerender block only means static when it covers the whole site — roughly, crawlLinks with no filter/routes narrowing, or an explicit full-export preset. When a routes list or a filter is present, a server entry is still produced and ssr is the safer answer. Erring toward ssr also fails softer: a static site served by the SSR adapter still works, whereas an SSR app deployed as static loses its server.

Note this method appears to have no callers in Appwrite today, so there is no live impact there; it was found while testing detection behaviour against open-source repositories.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Detection/Framework/TanStackStart.php and inspect TanStackStart::getAdapter(), focusing on how prerender configuration is classified. Reproduce the listed config cases, then update the behavior so narrowed routes or filters report ssr while full-site prerendering remains static, and verify the existing detection test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.