Skip to content

fix(pages): skip static page-data requests for routes with prerender disabled - #707

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/static-page-data
Nov 4, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
niteshseram:fix/static-page-data

Conversation

@niteshseram

Copy link
Copy Markdown
Contributor

With output: "static", navigating to a regular page that exports prerender = false first requests a static page-data file that was never generated:

GET /_void/pages/blog/example.json → 404
GET /blog/example                 → 200 (X-VoidPages)

The page eventually loads through the server fallback, but the failed static request adds a network round trip before the server request starts. Prefetching takes the same path.

Cause

resolveStaticPageDataBuildOptions() enables static page-data fetching for the app when output === "static".

The page scanner already records explicit prerender opt-outs, but generateComponentManifest() only included island flags in the client’s routeMeta. The browser therefore had no way to distinguish a route with prerendering disabled from one eligible for static page data.

matchStaticPageId() accepted any matched, non-island page with a component. Both navigation and prefetch used that check before requesting /_void/pages/<path>.json.

Fix

Include prerender: false in the generated route metadata for pages that explicitly opt out, preserving any existing island: true flag on the same route.

matchStaticPageId() now rejects those routes before a static JSON request starts. Because navigation and prefetch share this check, both request server page data directly:

GET /blog/example → 200 (X-VoidPages)

Metadata remains sparse: explicitly enabled and unset prerender settings do not add an entry. The check uses prerender !== false, so automatic prerendering and the existing static JSON fast path continue to work.

The shared navigation config and React client config types now accept the prerender metadata.

@cpojer
cpojer self-requested a review November 4, 2026 12:21

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@cpojer
cpojer merged commit 5d2a2ff into voidzero-dev:main Nov 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants