Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-hairs-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: never consider inert boundary effects
5 changes: 3 additions & 2 deletions packages/svelte/src/internal/client/reactivity/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
INSPECT_EFFECT,
HEAD_EFFECT,
MAYBE_DIRTY,
EFFECT_HAS_DERIVED
EFFECT_HAS_DERIVED,
BOUNDARY_EFFECT
} from '../constants.js';
import { set } from './sources.js';
import * as e from '../errors.js';
Expand Down Expand Up @@ -142,7 +143,7 @@ function create_effect(type, fn, sync, push = true) {
effect.first === null &&
effect.nodes_start === null &&
effect.teardown === null &&
(effect.f & EFFECT_HAS_DERIVED) === 0;
(effect.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;

if (!inert && !is_root && push) {
if (parent_effect !== null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
throw new Error();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { flushSync } from 'svelte';
import { test } from '../../test';

export default test({
html: '<button></button><div>0</div>',
mode: ['client'],
test({ assert, target }) {
let btn = target.querySelector('button');
let div = target.querySelector('div');

flushSync(() => {
btn?.click();
});

assert.equal(div?.innerHTML, `1`);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script>
import Child from "./Child.svelte"

let count = $state(0);
</script>

<button onclick={()=>count++}></button>
<svelte:boundary>
<Child />

{#snippet failed()}
<div>{count}</div>
{/snippet}
</svelte:boundary>
Loading