You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add missing hyphen in "server-side rendering"
* Fix incorrect use of "as such"
* server side spelling in error messages
* changeset
---------
Co-authored-by: Chew Tee Ming <[email protected]>
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/20-load.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -188,7 +188,7 @@ Conceptually, they're the same thing, but there are some important differences t
188
188
189
189
Server `load` functions _always_ run on the server.
190
190
191
-
By default, universal `load` functions run on the server during SSR when the user first visits your page. They will then run again during hydration, reusing any responses from [fetch requests](#Making-fetch-requests). All subsequent invocations of universal `load` functions happen in the browser. You can customize the behavior through [page options](page-options). If you disable [serverside rendering](page-options#ssr), you'll get an SPA and universal `load` functions _always_ run on the client.
191
+
By default, universal `load` functions run on the server during SSR when the user first visits your page. They will then run again during hydration, reusing any responses from [fetch requests](#Making-fetch-requests). All subsequent invocations of universal `load` functions happen in the browser. You can customize the behavior through [page options](page-options). If you disable [server-side rendering](page-options#ssr), you'll get an SPA and universal `load` functions _always_ run on the client.
192
192
193
193
If a route contains both universal and server `load` functions, the server `load` runs first.
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/60-remote-functions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: Remote functions
6
6
<p>Available since 2.27</p>
7
7
</blockquote>
8
8
9
-
Remote functions are a tool for type-safe communication between client and server. They can be _called_ anywhere in your app, but always _run_ on the server, and as such can safely access [server-only modules](server-only-modules) containing things like environment variables and database clients.
9
+
Remote functions are a tool for type-safe communication between client and server. They can be _called_ anywhere in your app, but always _run_ on the server, and thus can safely access [server-only modules](server-only-modules) containing things like environment variables and database clients.
10
10
11
11
Combined with Svelte's experimental support for [`await`](/docs/svelte/await-expressions), it allows you to load and manipulate data directly inside your components.
12
12
@@ -160,7 +160,7 @@ Any query can be updated via its `refresh` method:
160
160
</button>
161
161
```
162
162
163
-
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() ===getPosts()`. As such, you don't need a reference like `constposts=getPosts()` in order to refresh the query.
163
+
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() ===getPosts()`. This means you don't need a reference like `constposts=getPosts()` in order to refresh the query.
> [!NOTE] Svelte does not yet support asynchronous server-side rendering, and as such it's likely that you're only calling remote functions from the browser, rather than during prerendering. Because of this you will need to use `inputs`, for now. We're actively working on this roadblock.
659
+
> [!NOTE] Svelte does not yet support asynchronous server-side rendering, so it's likely that you're only calling remote functions from the browser, rather than during prerendering. Because of this, you will need to use `inputs`, for now. We're actively working on this roadblock.
660
660
661
661
By default, prerender functions are excluded from your server bundle, which means that you cannot call them with any arguments that were _not_ prerendered. You can set `dynamic:true` to change this behaviour:
Copy file name to clipboardExpand all lines: documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ This inconsistency is fixed in version 2. Paths are either always relative or al
90
90
91
91
## Server fetches are not trackable anymore
92
92
93
-
Previously it was possible to track URLs from `fetch`es on the server in order to rerun load functions. This poses a possible security risk (private URLs leaking), and as such it was behind the `dangerZone.trackServerFetches` setting, which is now removed.
93
+
Previously it was possible to track URLs from `fetch`es on the server in order to rerun load functions. This poses a possible security risk (private URLs leaking), and for this reason it was behind the `dangerZone.trackServerFetches` setting, which is now removed.
94
94
95
95
## `preloadCode` arguments must be prefixed with `base`
96
96
@@ -104,7 +104,7 @@ Additionally, `preloadCode` now takes a single argument rather than _n_ argument
104
104
105
105
SvelteKit 1 included a function called `resolvePath` which allows you to resolve a route ID (like `/blog/[slug]`) and a set of parameters (like `{ slug: 'hello' }`) to a pathname. Unfortunately the return value didn't include the `base` path, limiting its usefulness in cases where `base` was set.
106
106
107
-
As such, SvelteKit 2 replaces `resolvePath` with a (slightly better named) function called `resolveRoute`, which is imported from `$app/paths` and which takes `base` into account.
107
+
For this reason, SvelteKit 2 replaces `resolvePath` with a (slightly better named) function called `resolveRoute`, which is imported from `$app/paths` and which takes `base` into account.
108
108
109
109
```js
110
110
---import { resolvePath } from'@sveltejs/kit';
@@ -127,7 +127,7 @@ SvelteKit 2 cleans this up by calling `handleError` hooks with two new propertie
127
127
128
128
The `$env/dynamic/public` and `$env/dynamic/private` modules provide access to _run time_ environment variables, as opposed to the _build time_ environment variables exposed by `$env/static/public` and `$env/static/private`.
129
129
130
-
During prerendering in SvelteKit 1, they are one and the same. As such, prerendered pages that make use of 'dynamic' environment variables are really 'baking in' build time values, which is incorrect. Worse, `$env/dynamic/public` is populated in the browser with these stale values if the user happens to land on a prerendered page before navigating to dynamically-rendered pages.
130
+
During prerendering in SvelteKit 1, they are one and the same. Thus, prerendered pages that make use of 'dynamic' environment variables are really 'baking in' build time values, which is incorrect. Worse, `$env/dynamic/public` is populated in the browser with these stale values if the user happens to land on a prerendered page before navigating to dynamically-rendered pages.
131
131
132
132
Because of this, dynamic environment variables can no longer be read during prerendering in SvelteKit 2 — you should use the `static` modules instead. If the user lands on a prerendered page, SvelteKit will request up-to-date values for `$env/dynamic/public` from the server (by default from a module called `/_app/env.js`) instead of reading them from the server-rendered HTML.
Copy file name to clipboardExpand all lines: packages/kit/src/runtime/server/page/render.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -178,11 +178,11 @@ export async function render_response({
178
178
globalThis.fetch=(info,init)=>{
179
179
if(typeofinfo==='string'&&!SCHEME.test(info)){
180
180
thrownewError(
181
-
`Cannot call \`fetch\` eagerly during serverside rendering with relative URL (${info}) — put your \`fetch\` calls inside \`onMount\` or a \`load\` function instead`
181
+
`Cannot call \`fetch\` eagerly during server-side rendering with relative URL (${info}) — put your \`fetch\` calls inside \`onMount\` or a \`load\` function instead`
182
182
);
183
183
}elseif(!warned){
184
184
console.warn(
185
-
'Avoid calling `fetch` eagerly during serverside rendering — put your `fetch` calls inside `onMount` or a `load` function instead'
185
+
'Avoid calling `fetch` eagerly during server-side rendering — put your `fetch` calls inside `onMount` or a `load` function instead'
0 commit comments