Data loading
Fetch at build time, or fail the build.
Server pages fetch data with data(). Because pages are prerendered, the fetch runs once, at build time, and its result is baked into the static HTML.
The rules
data(fetcher)takes an async function and must be awaited.- Only callable at the top level of a server component body.
- A failed fetch fails the build. No silent fallback, no empty states.
- Calling
data()in a client component is a validation error (CLIENT_DATA_CALL). - No caching, no revalidation, no stale-while-revalidate in v1 - the fetch runs once per render.
- Not available in API routes or middleware (
API_DATA_CALL,MIDDLEWARE_DATA_CALL) - it is page-render-time fetching.
Why the build must fail: if a page cannot produce its content, it has no business deploying. Failing at build time turns a broken page into a broken build - which is visible to you, not to your users.
Dynamic data
When data changes per request, @marisjs/adapter-node re-executes data() routes at request time. @marisjs/adapter-static rejects such routes with an error naming every affected path - see Deploying: adapters.