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: .github/PULL_REQUEST_TEMPLATE.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,3 +8,7 @@
8
8
9
9
### Changesets
10
10
-[ ] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.
11
+
12
+
### Edits
13
+
14
+
Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,13 +43,13 @@ If you want to test against an existing project, you can use [pnpm `overrides`](
43
43
44
44
Entry points to be aware of are:
45
45
46
-
-[`packages/create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) - code that's run when you create a new project with `npm create svelte@latest`
47
-
-[`packages/package`](https://github.com/sveltejs/kit/tree/master/packages/package) - for the `svelte-package` command
48
-
-[`packages/kit/src/core`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/core) - code that's called at dev/build-time
49
-
-[`packages/kit/src/core/sync`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/core/sync) - for `svelte-kit sync`, which regenerates routing info and type definitions
50
-
-[`packages/kit/src/runtime`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/runtime) - code that's called at runtime
51
-
-[`packages/kit/src/exports/vite`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/exports/vite) - for all the Vite plugin related stuff
52
-
-[`packages/adapter-[platform]`](https://github.com/sveltejs/kit/tree/master/packages) - for the various SvelteKit-provided adapters
46
+
-[`packages/create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte) - code that's run when you create a new project with `npm create svelte@latest`
47
+
-[`packages/package`](https://github.com/sveltejs/kit/tree/main/packages/package) - for the `svelte-package` command
48
+
-[`packages/kit/src/core`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/core) - code that's called at dev/build-time
49
+
-[`packages/kit/src/core/sync`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/core/sync) - for `svelte-kit sync`, which regenerates routing info and type definitions
50
+
-[`packages/kit/src/runtime`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/runtime) - code that's called at runtime
51
+
-[`packages/kit/src/exports/vite`](https://github.com/sveltejs/kit/tree/main/packages/kit/src/exports/vite) - for all the Vite plugin related stuff
52
+
-[`packages/adapter-[platform]`](https://github.com/sveltejs/kit/tree/main/packages) - for the various SvelteKit-provided adapters
53
53
54
54
## Good first issues
55
55
@@ -101,7 +101,7 @@ If you would like to test local changes to Vite or another dependency, you can b
101
101
102
102
## Documentation changes
103
103
104
-
All documentation for SvelteKit is in the [`documentation` directory](https://github.com/sveltejs/kit/tree/master/documentation), and any improvements should be made as a Pull Request to this repository. The site itself is located in the [`sites/kit.svelte.dev` directory](https://github.com/sveltejs/kit/tree/master/sites/kit.svelte.dev) and can be run locally to preview changes.
104
+
All documentation for SvelteKit is in the [`documentation` directory](https://github.com/sveltejs/kit/tree/main/documentation), and any improvements should be made as a Pull Request to this repository. The site itself is located in the [`sites/kit.svelte.dev` directory](https://github.com/sveltejs/kit/tree/main/sites/kit.svelte.dev) and can be run locally to preview changes.
Copy file name to clipboardExpand all lines: documentation/docs/10-getting-started/20-creating-a-project.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
@@ -22,4 +22,4 @@ Try editing the files to get a feel for how everything works.
22
22
23
23
## Editor setup
24
24
25
-
We recommend using [Visual Studio Code (aka VS Code)](https://code.visualstudio.com/download) with [the Svelte extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), but [support also exists for numerous other editors](https://sveltesociety.dev/tools#editor-support).
25
+
We recommend using [Visual Studio Code (aka VS Code)](https://code.visualstudio.com/download) with [the Svelte extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode), but [support also exists for numerous other editors](https://sveltesociety.dev/resources#editor-support).
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/20-load.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,6 +168,8 @@ Server `load` functions _always_ run on the server.
168
168
169
169
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.
170
170
171
+
If a route contains both universal and server `load` functions, the server `load` runs first.
172
+
171
173
A `load` function is invoked at runtime, unless you [prerender](page-options#prerender) the page — in that case, it's invoked at build time.
172
174
173
175
### Input
@@ -190,7 +192,29 @@ Server `load` functions are convenient when you need to access data directly fro
190
192
191
193
Universal `load` functions are useful when you need to `fetch` data from an external API and don't need private credentials, since SvelteKit can get the data directly from the API rather than going via your server. They are also useful when you need to return something that can't be serialized, such as a Svelte component constructor.
192
194
193
-
In rare cases, you might need to use both together — for example, you might need to return an instance of a custom class that was initialised with data from your server.
195
+
In rare cases, you might need to use both together — for example, you might need to return an instance of a custom class that was initialised with data from your server. When using both, the server `load` return value is _not_ passed directly to the page, but to the universal `load` function (as the `data` property):
196
+
197
+
```js
198
+
/// file: src/routes/+page.server.js
199
+
/**@type{import('./$types').PageServerLoad}*/
200
+
exportasyncfunctionload() {
201
+
return {
202
+
serverMessage:'hello from server load function'
203
+
};
204
+
}
205
+
```
206
+
207
+
```js
208
+
/// file: src/routes/+page.js
209
+
// @errors: 18047
210
+
/**@type{import('./$types').PageLoad}*/
211
+
exportasyncfunctionload({ data }) {
212
+
return {
213
+
serverMessage:data.serverMessage,
214
+
universalMessage:'hello from universal load function'
0 commit comments