Skip to content

Commit f344267

Browse files
author
Rich Harris
committed
merge master
2 parents 2820d05 + bc70b4e commit f344267

File tree

27 files changed

+221
-249
lines changed

27 files changed

+221
-249
lines changed

.changeset/shy-pears-invent.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: only skip hydration with vite overlay if current page is an error

CONTRIBUTING.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ cd kit
1616
pnpm install
1717
```
1818

19-
You can now run SvelteKit by linking it into your project with [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides) as demonstrated in the [sandbox example](https://github.com/sveltejs/kit-sandbox) or by running one of the test projects as described in [the testing section](#testing) below.
19+
You can now run SvelteKit by linking it into your project with [pnpm `overrides`](https://pnpm.io/package_json#pnpmoverrides):
20+
21+
```jsonc
22+
{
23+
// ...
24+
"pnpm": {
25+
"overrides": {
26+
"@sveltejs/kit": "link:../path/to/svelte-kit/packages/kit",
27+
// additionally/optional the adapter you're using
28+
"@sveltejs/adapter-auto": "link:../path/to/svelte-kit/packages/adapter-auto"
29+
}
30+
}
31+
}
32+
```
2033

2134
## Code structure
2235

@@ -44,7 +57,7 @@ Run `pnpm test` to run the tests from all subpackages. Browser tests live in sub
4457

4558
You can run the tests for only a single package by first moving to that directory. E.g. `cd packages/kit`.
4659

47-
You must rebuild each time before running the tests if you've made code changes.
60+
For some packages you must rebuild each time before running the tests if you've made code changes. These packages have a `build` command. Packages like `packages/kit` don't require a build step.
4861

4962
To run a single integration test or otherwise control the running of the tests locally see [the Playwright CLI docs](https://playwright.dev/docs/test-cli). Note that you will need to run these commands from the test project directory such as `packages/kit/test/apps/basics`.
5063

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function load({ params }) {
3434

3535
Thanks to the generated `$types` module, we get full type safety.
3636

37-
A `load` function in a `+page.js` file runs both on the server and in the browser. If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
37+
A `load` function in a `+page.js` file runs both on the server and in the browser (unless combined with `export const ssr = false`, in which case it will [only run in the browser](https://kit.svelte.dev/docs/page-options#ssr)). If your `load` function should _always_ run on the server (because it uses private environment variables, for example, or accesses a database) then it would go in a `+page.server.js` instead.
3838

3939
A more realistic version of your blog post's `load` function, that only runs on the server and pulls data from a database, might look like this:
4040

@@ -578,10 +578,12 @@ export async function load({ fetch, depends }) {
578578
<button on:click={rerunLoadFunction}>Update random number</button>
579579
```
580580

581+
### When do load functions re-run?
582+
581583
To summarize, a `load` function will re-run in the following situations:
582584

583585
- It references a property of `params` whose value has changed
584-
- It references a property of `url` (such as `url.pathname` or `url.search`) whose value has changed
586+
- It references a property of `url` (such as `url.pathname` or `url.search`) whose value has changed. Properties in `request.url` are _not_ tracked
585587
- It calls `await parent()` and a parent `load` function re-ran
586588
- It declared a dependency on a specific URL via [`fetch`](#making-fetch-requests) or [`depends`](types#public-types-loadevent), and that URL was marked invalid with [`invalidate(url)`](modules#$app-navigation-invalidate)
587589
- All active `load` functions were forcibly re-run with [`invalidateAll()`](modules#$app-navigation-invalidateall)

documentation/docs/20-core-concepts/40-page-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ SvelteKit will discover pages to prerender automatically, by starting at _entry
101101

102102
Most of the time, that's enough. In some situations, links to pages like `/blog/hello-world` might not exist (or might not exist on prerendered pages), in which case we need to tell SvelteKit about their existence.
103103

104-
This can be done with [`config.kit.prerender.entries`](configuration#prerender), or by exporting an `entries` function from a `+page.js` or `+page.server.js` belonging to a dynamic route:
104+
This can be done with [`config.kit.prerender.entries`](configuration#prerender), or by exporting an `entries` function from a `+page.js`, a `+page.server.js` or a `+server.js` belonging to a dynamic route:
105105

106106
```js
107107
/// file: src/routes/blog/[slug]/+page.server.js

documentation/docs/30-advanced/20-hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Sentry.init({/*...*/})
180180
export async function handleError({ error, event }) {
181181
const errorId = crypto.randomUUID();
182182
// example integration with https://sentry.io/
183-
Sentry.captureException(error, { event, errorId });
183+
Sentry.captureException(error, { extra: { event, errorId } });
184184

185185
return {
186186
message: 'Whoops!',
@@ -208,7 +208,7 @@ Sentry.init({/*...*/})
208208
export async function handleError({ error, event }) {
209209
const errorId = crypto.randomUUID();
210210
// example integration with https://sentry.io/
211-
Sentry.captureException(error, { event, errorId });
211+
Sentry.captureException(error, { extra: { event, errorId } });
212212

213213
return {
214214
message: 'Whoops!',

documentation/docs/30-advanced/25-errors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Sentry.init({/*...*/})
9797
/** @type {import('@sveltejs/kit').HandleServerError} */
9898
export function handleError({ error, event }) {
9999
// example integration with https://sentry.io/
100-
Sentry.captureException(error, { event });
100+
Sentry.captureException(error, { extra: { event } });
101101

102102
return {
103103
message: 'Whoops!',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
3535
"@typescript-eslint/eslint-plugin": "^5.53.0",
3636
"eslint": "^8.33.0",
37-
"eslint-plugin-unicorn": "^46.0.0",
37+
"eslint-plugin-unicorn": "^47.0.0",
3838
"playwright": "1.30.0",
3939
"prettier": "^2.8.0",
4040
"rollup": "^3.7.0",

packages/adapter-static/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
"lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
2828
"check": "tsc",
2929
"format": "pnpm lint --write",
30-
"test": "uvu test test.js"
30+
"test": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test"
3131
},
3232
"devDependencies": {
33+
"@playwright/test": "1.30.0",
3334
"@sveltejs/kit": "workspace:^",
3435
"@types/node": "^16.18.6",
3536
"sirv": "^2.0.3",
3637
"svelte": "^3.56.0",
3738
"typescript": "^5.0.4",
38-
"uvu": "^0.5.6",
3939
"vite": "^4.3.0"
4040
},
4141
"peerDependencies": {
4242
"@sveltejs/kit": "^1.5.0"
4343
}
44-
}
44+
}

packages/adapter-static/test/apps/prerendered/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
"scripts": {
66
"dev": "vite dev",
77
"build": "vite build",
8-
"start": "vite start"
8+
"preview": "sirv -p 5173 -s 200.html build",
9+
"test": "playwright test"
910
},
1011
"devDependencies": {
1112
"@sveltejs/kit": "workspace:^",
13+
"sirv-cli": "^2.0.2",
1214
"svelte": "^3.56.0",
1315
"vite": "^4.3.0"
1416
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { config as default } from '../../utils.js';

0 commit comments

Comments
 (0)