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
Copy file name to clipboardexpand all lines: apps/svelte.dev/content/docs/kit/20-core-concepts/30-form-actions.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -354,7 +354,7 @@ The easiest way to progressively enhance a form is to add the `use:enhance` acti
354
354
<form method="POST"+++use:enhance+++>
355
355
```
356
356
357
-
> [!NOTE] `use:enhance` can only be used with forms that have `method="POST"`. It will not work with `method="GET"`, which is the default for forms without a specified method. Attempting to use `use:enhance` on forms without `method="POST"` will result in an error.
357
+
> [!NOTE] `use:enhance` can only be used with forms that have `method="POST"` and point to actions defined in a `+page.server.js` file. It will not work with `method="GET"`, which is the default for forms without a specified method. Attempting to use `use:enhance` on forms without `method="POST"` or posting to a `+server.js` endpoint will result in an error.
358
358
359
359
> [!NOTE] Yes, it's a little confusing that the `enhance` action and `<form action>` are both called 'action'. These docs are action-packed. Sorry.
Copy file name to clipboardexpand all lines: apps/svelte.dev/content/docs/kit/60-appendix/30-migrating-to-sveltekit-2.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ The `$env/dynamic/public` and `$env/dynamic/private` modules provide access to _
130
130
131
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.
132
132
133
-
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 `_env.js` — this can be configured with `config.kit.env.publicModule`) instead of reading them from the server-rendered HTML.
133
+
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.
134
134
135
135
## `form` and `data` have been removed from `use:enhance` callbacks
Copy file name to clipboardexpand all lines: apps/svelte.dev/content/docs/kit/98-reference/50-configuration.md
+35
Original file line number
Diff line number
Diff line change
@@ -1085,6 +1085,41 @@ What type of client-side router to use.
1085
1085
-`'hash'` means the route is determined by `location.hash`. In this case, SSR and prerendering are disabled. This is only recommended if `pathname` is not an option, for example because you don't control the webserver where your app is deployed.
1086
1086
It comes with some caveats: you can't use server-side rendering (or indeed any server logic), and you have to make sure that the links in your app all start with #/, or they won't work. Beyond that, everything works exactly like a normal SvelteKit app.
How to determine which route to load when navigating to a new page.
1107
+
1108
+
By default, SvelteKit will serve a route manifest to the browser.
1109
+
When navigating, this manifest is used (along with the `reroute` hook, if it exists) to determine which components to load and which `load` functions to run.
1110
+
Because everything happens on the client, this decision can be made immediately. The drawback is that the manifest needs to be
1111
+
loaded and parsed before the first navigation can happen, which may have an impact if your app contains many routes.
1112
+
1113
+
Alternatively, SvelteKit can determine the route on the server. This means that for every navigation to a path that has not yet been visited, the server will be asked to determine the route.
1114
+
This has several advantages:
1115
+
- The client does not need to load the routing manifest upfront, which can lead to faster initial page loads
1116
+
- The list of routes is hidden from public view
1117
+
- The server has an opportunity to intercept each navigation (for example through a middleware), enabling (for example) A/B testing opaque to SvelteKit
1118
+
1119
+
The drawback is that for unvisited paths, resolution will take slightly longer (though this is mitigated by [preloading](/docs/kit/link-options#data-sveltekit-preload-data)).
1120
+
1121
+
> [!NOTE] When using server-side route resolution and prerendering, the resolution is prerendered along with the route itself.
0 commit comments