Skip to content

Commit 460108e

Browse files
docs: corrections (#14101)
* 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]>
1 parent 0b05a95 commit 460108e

File tree

8 files changed

+17
-12
lines changed

8 files changed

+17
-12
lines changed

.changeset/light-facts-hope.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: correctly spell server-side in error messages

documentation/docs/20-core-concepts/20-load.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Conceptually, they're the same thing, but there are some important differences t
188188

189189
Server `load` functions _always_ run on the server.
190190

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.
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.
192192

193193
If a route contains both universal and server `load` functions, the server `load` runs first.
194194

documentation/docs/20-core-concepts/60-remote-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Remote functions
66
<p>Available since 2.27</p>
77
</blockquote>
88

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.
1010

1111
Combined with Svelte's experimental support for [`await`](/docs/svelte/await-expressions), it allows you to load and manipulate data directly inside your components.
1212

@@ -160,7 +160,7 @@ Any query can be updated via its `refresh` method:
160160
</button>
161161
```
162162
163-
> [!NOTE] Queries are cached while they're on the page, meaning `getPosts() === getPosts()`. As such, you don't need a reference like `const posts = 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 `const posts = getPosts()` in order to refresh the query.
164164
165165
## form
166166
@@ -656,7 +656,7 @@ export const getPost = prerender(
656656
);
657657
```
658658
659-
> [!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.
660660
661661
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:
662662

documentation/docs/60-appendix/30-migrating-to-sveltekit-2.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ This inconsistency is fixed in version 2. Paths are either always relative or al
9090

9191
## Server fetches are not trackable anymore
9292

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.
9494

9595
## `preloadCode` arguments must be prefixed with `base`
9696

@@ -104,7 +104,7 @@ Additionally, `preloadCode` now takes a single argument rather than _n_ argument
104104

105105
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.
106106

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.
108108

109109
```js
110110
---import { resolvePath } from '@sveltejs/kit';
@@ -127,7 +127,7 @@ SvelteKit 2 cleans this up by calling `handleError` hooks with two new propertie
127127

128128
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`.
129129

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.
131131

132132
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.
133133

packages/kit/src/core/generate_manifest/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function generate_manifest({ build_data, prerendered, relative_path, rout
5959
assets.push(build_data.service_worker);
6060
}
6161

62-
// In case of server side route resolution, we need to include all matchers. Prerendered routes are not part
62+
// In case of server-side route resolution, we need to include all matchers. Prerendered routes are not part
6363
// of the server manifest, and they could reference matchers that then would not be included.
6464
const matchers = new Set(
6565
build_data.client?.nodes ? Object.keys(build_data.manifest_data.matchers) : undefined

packages/kit/src/runtime/server/page/render.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ export async function render_response({
178178
globalThis.fetch = (info, init) => {
179179
if (typeof info === 'string' && !SCHEME.test(info)) {
180180
throw new Error(
181-
`Cannot call \`fetch\` eagerly during server side 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`
182182
);
183183
} else if (!warned) {
184184
console.warn(
185-
'Avoid calling `fetch` eagerly during server side 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'
186186
);
187187
warned = true;
188188
}

packages/kit/src/types/internal.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export interface BuildData {
9090
*/
9191
css?: Array<string[] | undefined>;
9292
/**
93-
* Contains the client route manifest in a form suitable for the server which is used for server side route resolution.
93+
* Contains the client route manifest in a form suitable for the server which is used for server-side route resolution.
9494
* Notably, it contains all routes, regardless of whether they are prerendered or not (those are missing in the optimized server route manifest).
9595
* Only set in case of `router.resolution === 'server'`.
9696
*/

packages/kit/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ declare module '@sveltejs/kit' {
18931893
*/
18941894
css?: Array<string[] | undefined>;
18951895
/**
1896-
* Contains the client route manifest in a form suitable for the server which is used for server side route resolution.
1896+
* Contains the client route manifest in a form suitable for the server which is used for server-side route resolution.
18971897
* Notably, it contains all routes, regardless of whether they are prerendered or not (those are missing in the optimized server route manifest).
18981898
* Only set in case of `router.resolution === 'server'`.
18991899
*/

0 commit comments

Comments
 (0)