Skip to content

Commit ec7da97

Browse files
sync kit docs
1 parent 9333a8a commit ec7da97

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

apps/svelte.dev/content/docs/kit/20-core-concepts/20-load.md

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

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

192-
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+
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.
193193

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

apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md

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

10-
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.
10+
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.
1111

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

@@ -114,7 +114,7 @@ Query functions can accept an argument, such as the `slug` of an individual post
114114

115115
let { params } = $props();
116116

117-
const post = getPost(params.slug);
117+
const post = await getPost(params.slug);
118118
</script>
119119

120120
<h1>{post.title}</h1>
@@ -161,7 +161,7 @@ Any query can be updated via its `refresh` method:
161161
</button>
162162
```
163163
164-
> [!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.
164+
> [!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.
165165
166166
## form
167167
@@ -657,7 +657,7 @@ export const getPost = prerender(
657657
);
658658
```
659659
660-
> [!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.
660+
> [!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.
661661
662662
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:
663663

apps/svelte.dev/content/docs/kit/60-appendix/30-migrating-to-sveltekit-2.md

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

9292
## Server fetches are not trackable anymore
9393

94-
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.
94+
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.
9595

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

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

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

108-
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.
108+
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.
109109

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

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

131-
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.
131+
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.
132132

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

apps/svelte.dev/content/docs/kit/98-reference/20-$app-server.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function command<Schema extends StandardSchemaV1, Output>(
5757
validate: Schema,
5858
fn: (arg: StandardSchemaV1.InferOutput<Schema>) => Output
5959
): RemoteCommand<
60-
StandardSchemaV1.InferOutput<Schema>,
60+
StandardSchemaV1.InferInput<Schema>,
6161
Output
6262
>;
6363
```
@@ -171,13 +171,13 @@ function prerender<Schema extends StandardSchemaV1, Output>(
171171
options?:
172172
| {
173173
inputs?: RemotePrerenderInputsGenerator<
174-
StandardSchemaV1.InferOutput<Schema>
174+
StandardSchemaV1.InferInput<Schema>
175175
>;
176176
dynamic?: boolean;
177177
}
178178
| undefined
179179
): RemotePrerenderFunction<
180-
StandardSchemaV1.InferOutput<Schema>,
180+
StandardSchemaV1.InferInput<Schema>,
181181
Output
182182
>;
183183
```
@@ -228,7 +228,7 @@ function query<Schema extends StandardSchemaV1, Output>(
228228
arg: StandardSchemaV1.InferOutput<Schema>
229229
) => MaybePromise<Output>
230230
): RemoteQueryFunction<
231-
StandardSchemaV1.InferOutput<Schema>,
231+
StandardSchemaV1.InferInput<Schema>,
232232
Output
233233
>;
234234
```

0 commit comments

Comments
 (0)