Skip to content

docs: explain runtime environment App Shells - #97126

Draft
DavidIlie wants to merge 1 commit into
codex/prerender-status-build-outputfrom
codex/runtime-env-app-shell-docs
Draft

docs: explain runtime environment App Shells#97126
DavidIlie wants to merge 1 commit into
codex/prerender-status-build-outputfrom
codex/runtime-env-app-shell-docs

Conversation

@DavidIlie

Copy link
Copy Markdown
Contributor

What?

Document how server runtime environment variables interact with Cache Components and Partial Prefetching.

The guide now shows how to place io() before an environment-dependent branch, when to use connection() instead, what runtime prefetches contain, and why a streamed notFound() remains 200 with noindex. The self-hosting and Partial Prefetching pages cross-link the guidance.

Why?

Reading process.env is not itself a Request-time API. A synchronous branch can run during next build, so conditional UI, notFound(), or redirect() can become part of the App Shell. Starting the same Docker image with a different value does not regenerate that prerendered result.

This can be especially confusing when metadata is dynamic but the page component is not: a navigation may receive runtime metadata while the body still comes from a build-time error shell.

How?

  • Explain that the dynamic marker must appear before every environment-dependent branch.
  • Use io() for synchronous uncached runtime I/O and connection() when evaluation must wait for an actual navigation.
  • Clarify that, in the uncached example, both leave a hole during runtime prefetch and evaluate during the full dynamic render.
  • Explain the streamed status-code tradeoff and point hard-404 requirements to a lightweight check in Proxy.
  • Document the parent PR's [status: 404] build annotation as an informational diagnostic.

This PR is stacked on #97125, which adds the build-output diagnostic it documents.

Verification

  • Targeted Prettier and ESLint
  • git diff --check

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Stats skipped

Commit: cdd8654
View workflow run

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tests Passed

Commit: cdd8654

@DavidIlie
DavidIlie force-pushed the codex/runtime-env-app-shell-docs branch from 96fbcc6 to cdd8654 Compare August 10, 2026 17:48
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.

1 participant