From 6df59055e7f67328b3b3c3495120a14db4d8544b Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 30 Jan 2025 19:46:53 +0100 Subject: [PATCH 1/6] docs: more examples on what is outside the rendering process (#15157) closes #15151 --- documentation/docs/05-special-elements/01-svelte-boundary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/05-special-elements/01-svelte-boundary.md b/documentation/docs/05-special-elements/01-svelte-boundary.md index 15f249a771..f5439b4b83 100644 --- a/documentation/docs/05-special-elements/01-svelte-boundary.md +++ b/documentation/docs/05-special-elements/01-svelte-boundary.md @@ -13,7 +13,7 @@ Boundaries allow you to guard against errors in part of your app from breaking t If an error occurs while rendering or updating the children of a ``, or running any [`$effect`]($effect) functions contained therein, the contents will be removed. -Errors occurring outside the rendering process (for example, in event handlers) are _not_ caught by error boundaries. +Errors occurring outside the rendering process (for example, in event handlers or after a `setTimeout` or async work) are _not_ caught by error boundaries. ## Properties From 674f81b5ceaa1968263b74547b7b2887f74f02fd Mon Sep 17 00:00:00 2001 From: Scott Wu Date: Fri, 31 Jan 2025 02:48:35 +0800 Subject: [PATCH 2/6] [docs] clarify that `$effect` analyzes functions deeply (#15144) * Update 04-$effect.md * Update documentation/docs/02-runes/04-$effect.md --------- Co-authored-by: Rich Harris --- documentation/docs/02-runes/04-$effect.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/02-runes/04-$effect.md b/documentation/docs/02-runes/04-$effect.md index 1ea960de70..da24084d4d 100644 --- a/documentation/docs/02-runes/04-$effect.md +++ b/documentation/docs/02-runes/04-$effect.md @@ -66,7 +66,7 @@ You can return a function from `$effect`, which will run immediately before the ### Understanding dependencies -`$effect` automatically picks up any reactive values (`$state`, `$derived`, `$props`) that are _synchronously_ read inside its function body and registers them as dependencies. When those dependencies change, the `$effect` schedules a rerun. +`$effect` automatically picks up any reactive values (`$state`, `$derived`, `$props`) that are _synchronously_ read inside its function body (including indirectly, via function calls) and registers them as dependencies. When those dependencies change, the `$effect` schedules a rerun. Values that are read _asynchronously_ — after an `await` or inside a `setTimeout`, for example — will not be tracked. Here, the canvas will be repainted when `color` changes, but not when `size` changes ([demo](/playground/untitled#H4sIAAAAAAAAE31T246bMBD9lZF3pWSlBEirfaEQqdo_2PatVIpjBrDkGGQPJGnEv1e2IZfVal-wfHzmzJyZ4cIqqdCy9M-F0blDlnqArZjmB3f72XWRHVCRw_bc4me4aDWhJstSlllhZEfbQhekkMDKfwg5PFvihMvX5OXH_CJa1Zrb0-Kpqr5jkiwC48rieuDWQbqgZ6wqFLRcvkC-hYvnkWi1dWqa8ESQTxFRjfQWsOXiWzmr0sSLhEJu3p1YsoJkNUcdZUnN9dagrBu6FVRQHAM10sJRKgUG16bXcGxQ44AGdt7SDkTDdY02iqLHnJVU6hedlWuIp94JW6Tf8oBt_8GdTxlF0b4n0C35ZLBzXb3mmYn3ae6cOW74zj0YVzDNYXRHFt9mprNgHfZSl6mzml8CMoLvTV6wTZIUDEJv5us2iwMtiJRyAKG4tXnhl8O0yhbML0Wm-B7VNlSSSd31BG7z8oIZZ6dgIffAVY_5xdU9Qrz1Bnx8fCfwtZ7v8Qc9j3nB8PqgmMWlHIID6-bkVaPZwDySfWtKNGtquxQ23Qlsq2QJT0KIqb8dL0up6xQ2eIBkAg_c1FI_YqW0neLnFCqFpwmreedJYT7XX8FVOBfwWRhXstZrSXiwKQjUhOZeMIleb5JZfHWn2Yq5pWEpmR7Hv-N_wEqT8hEEAAA=)): From 2be3823e3aaaad753d65d21a160e342bd9b1c514 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 30 Jan 2025 13:49:01 -0500 Subject: [PATCH 3/6] chore: remove inert check from each block reconciliation (#15143) --- .../src/internal/client/dom/blocks/each.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/svelte/src/internal/client/dom/blocks/each.js b/packages/svelte/src/internal/client/dom/blocks/each.js index 040e585215..3baa03a917 100644 --- a/packages/svelte/src/internal/client/dom/blocks/each.js +++ b/packages/svelte/src/internal/client/dom/blocks/each.js @@ -219,17 +219,7 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f } if (!hydrating) { - var effect = /** @type {Effect} */ (active_reaction); - reconcile( - array, - state, - anchor, - render_fn, - flags, - (effect.f & INERT) !== 0, - get_key, - get_collection - ); + reconcile(array, state, anchor, render_fn, flags, get_key, get_collection); } if (fallback_fn !== null) { @@ -273,12 +263,11 @@ export function each(node, flags, get_collection, get_key, render_fn, fallback_f * @param {Element | Comment | Text} anchor * @param {(anchor: Node, item: MaybeSource, index: number | Source, collection: () => V[]) => void} render_fn * @param {number} flags - * @param {boolean} is_inert * @param {(value: V, index: number) => any} get_key * @param {() => V[]} get_collection * @returns {void} */ -function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, get_collection) { +function reconcile(array, state, anchor, render_fn, flags, get_key, get_collection) { var is_animated = (flags & EACH_IS_ANIMATED) !== 0; var should_update = (flags & (EACH_ITEM_REACTIVE | EACH_INDEX_REACTIVE)) !== 0; @@ -420,7 +409,7 @@ function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, ge while (current !== null && current.k !== key) { // If the each block isn't inert and an item has an effect that is already inert, // skip over adding it to our seen Set as the item is already being handled - if (is_inert || (current.e.f & INERT) === 0) { + if ((current.e.f & INERT) === 0) { (seen ??= new Set()).add(current); } stashed.push(current); @@ -444,7 +433,7 @@ function reconcile(array, state, anchor, render_fn, flags, is_inert, get_key, ge while (current !== null) { // If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished - if (is_inert || (current.e.f & INERT) === 0) { + if ((current.e.f & INERT) === 0) { to_destroy.push(current); } current = current.next; From 04addca428411088045b5a1774511593b5acc040 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:50:00 -0500 Subject: [PATCH 4/6] Version Packages (#15156) Co-authored-by: github-actions[bot] --- .changeset/famous-bulldogs-tan.md | 5 ----- .changeset/good-rocks-talk.md | 5 ----- .changeset/loud-cars-scream.md | 5 ----- .changeset/odd-rules-hear.md | 5 ----- .changeset/ten-cougars-look.md | 5 ----- .changeset/unlucky-gorillas-hunt.md | 5 ----- packages/svelte/CHANGELOG.md | 16 ++++++++++++++++ packages/svelte/package.json | 2 +- packages/svelte/src/version.js | 2 +- 9 files changed, 18 insertions(+), 32 deletions(-) delete mode 100644 .changeset/famous-bulldogs-tan.md delete mode 100644 .changeset/good-rocks-talk.md delete mode 100644 .changeset/loud-cars-scream.md delete mode 100644 .changeset/odd-rules-hear.md delete mode 100644 .changeset/ten-cougars-look.md delete mode 100644 .changeset/unlucky-gorillas-hunt.md diff --git a/.changeset/famous-bulldogs-tan.md b/.changeset/famous-bulldogs-tan.md deleted file mode 100644 index a5cc14b7f2..0000000000 --- a/.changeset/famous-bulldogs-tan.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: do not prune selectors like `:global(.foo):has(.scoped)` diff --git a/.changeset/good-rocks-talk.md b/.changeset/good-rocks-talk.md deleted file mode 100644 index 59af86c686..0000000000 --- a/.changeset/good-rocks-talk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: don't error on slot prop inside block inside other component diff --git a/.changeset/loud-cars-scream.md b/.changeset/loud-cars-scream.md deleted file mode 100644 index 2b61bc4453..0000000000 --- a/.changeset/loud-cars-scream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: ensure reactions are correctly attached for unowned deriveds diff --git a/.changeset/odd-rules-hear.md b/.changeset/odd-rules-hear.md deleted file mode 100644 index 325b8ddf96..0000000000 --- a/.changeset/odd-rules-hear.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: silence a11y attribute warnings when spread attributes present diff --git a/.changeset/ten-cougars-look.md b/.changeset/ten-cougars-look.md deleted file mode 100644 index fe20d057dd..0000000000 --- a/.changeset/ten-cougars-look.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: prevent false-positive ownership validations due to hot reload diff --git a/.changeset/unlucky-gorillas-hunt.md b/.changeset/unlucky-gorillas-hunt.md deleted file mode 100644 index 055fc120a6..0000000000 --- a/.changeset/unlucky-gorillas-hunt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: widen ownership when calling setContext diff --git a/packages/svelte/CHANGELOG.md b/packages/svelte/CHANGELOG.md index bb48391e0e..0e8073cc5d 100644 --- a/packages/svelte/CHANGELOG.md +++ b/packages/svelte/CHANGELOG.md @@ -1,5 +1,21 @@ # svelte +## 5.19.6 + +### Patch Changes + +- fix: do not prune selectors like `:global(.foo):has(.scoped)` ([#15140](https://github.com/sveltejs/svelte/pull/15140)) + +- fix: don't error on slot prop inside block inside other component ([#15148](https://github.com/sveltejs/svelte/pull/15148)) + +- fix: ensure reactions are correctly attached for unowned deriveds ([#15158](https://github.com/sveltejs/svelte/pull/15158)) + +- fix: silence a11y attribute warnings when spread attributes present ([#15150](https://github.com/sveltejs/svelte/pull/15150)) + +- fix: prevent false-positive ownership validations due to hot reload ([#15154](https://github.com/sveltejs/svelte/pull/15154)) + +- fix: widen ownership when calling setContext ([#15153](https://github.com/sveltejs/svelte/pull/15153)) + ## 5.19.5 ### Patch Changes diff --git a/packages/svelte/package.json b/packages/svelte/package.json index a44ba43364..a286fa119d 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -2,7 +2,7 @@ "name": "svelte", "description": "Cybernetically enhanced web apps", "license": "MIT", - "version": "5.19.5", + "version": "5.19.6", "type": "module", "types": "./types/index.d.ts", "engines": { diff --git a/packages/svelte/src/version.js b/packages/svelte/src/version.js index a509ef3fec..03ab37b583 100644 --- a/packages/svelte/src/version.js +++ b/packages/svelte/src/version.js @@ -4,5 +4,5 @@ * The current version, as set in package.json. * @type {string} */ -export const VERSION = '5.19.5'; +export const VERSION = '5.19.6'; export const PUBLIC_VERSION = '5'; From e83ab1c0382199b50b0d2255668cd3f13cc603a2 Mon Sep 17 00:00:00 2001 From: tomoam <29677552+tomoam@users.noreply.github.com> Date: Fri, 31 Jan 2025 05:12:31 +0900 Subject: [PATCH 6/6] docs: fix typos and a link (#15135) --- documentation/docs/03-template-syntax/09-@const.md | 2 +- documentation/docs/03-template-syntax/11-bind.md | 2 +- documentation/docs/04-styling/01-scoped-styles.md | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/documentation/docs/03-template-syntax/09-@const.md b/documentation/docs/03-template-syntax/09-@const.md index c42d3560fd..2a587b7a3d 100644 --- a/documentation/docs/03-template-syntax/09-@const.md +++ b/documentation/docs/03-template-syntax/09-@const.md @@ -11,4 +11,4 @@ The `{@const ...}` tag defines a local constant. {/each} ``` -`{@const}` is only allowed as an immediate child of a block — `{#if ...}`, `{#each ...}`, `{#snippet ...}` and so on — a `` or a `` or a ``. diff --git a/documentation/docs/03-template-syntax/11-bind.md b/documentation/docs/03-template-syntax/11-bind.md index 90046c8c45..e56c2b4f77 100644 --- a/documentation/docs/03-template-syntax/11-bind.md +++ b/documentation/docs/03-template-syntax/11-bind.md @@ -235,7 +235,7 @@ You can give the `