From 7ad9aa5935e831f549dd9fbdcb1f66f44b51d951 Mon Sep 17 00:00:00 2001 From: razinshafayet Date: Mon, 23 Feb 2026 22:51:10 +0600 Subject: [PATCH] docs: clarify query vs prerender on prerendered pages --- documentation/docs/20-core-concepts/60-remote-functions.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/docs/20-core-concepts/60-remote-functions.md b/documentation/docs/20-core-concepts/60-remote-functions.md index dedfc0f06e17..7ada266a6537 100644 --- a/documentation/docs/20-core-concepts/60-remote-functions.md +++ b/documentation/docs/20-core-concepts/60-remote-functions.md @@ -39,6 +39,8 @@ Remote functions are exported from a `.remote.js` or `.remote.ts` file, and come The `query` function allows you to read dynamic data from the server (for _static_ data, consider using [`prerender`](#prerender) instead): +> [!NOTE] `query` functions need a server at runtime. They cannot be used while prerendering (for example when `export const prerender = true` is set on the page or a parent `+layout`). If you need data during prerendering, use [`prerender`](#prerender) instead. + ```js /// file: src/routes/blog/data.remote.js // @filename: ambient.d.ts @@ -1041,7 +1043,7 @@ You can use `prerender` functions on pages that are otherwise dynamic, allowing In the browser, prerendered data is saved using the [`Cache`](https://developer.mozilla.org/en-US/docs/Web/API/Cache) API. This cache survives page reloads, and will be cleared when the user first visits a new deployment of your app. -> [!NOTE] When the entire page has `export const prerender = true`, you cannot use queries, as they are dynamic. +> [!NOTE] `prerender` functions run at build time, so they work on prerendered pages and in fully static builds (for example with [`adapter-static`](adapter-static)). The restriction applies to [`query`](#query): it requires a server at runtime and will fail if called during prerendering. ### Prerender arguments