Skip to content

Commit 8a1acac

Browse files
fix: never consider inert boundary effects (#14999)
* fix: never consider inert boundary effects * chore: inline bitwise
1 parent 36ef59d commit 8a1acac

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

.changeset/healthy-hairs-run.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: never consider inert boundary effects

packages/svelte/src/internal/client/reactivity/effects.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import {
3535
INSPECT_EFFECT,
3636
HEAD_EFFECT,
3737
MAYBE_DIRTY,
38-
EFFECT_HAS_DERIVED
38+
EFFECT_HAS_DERIVED,
39+
BOUNDARY_EFFECT
3940
} from '../constants.js';
4041
import { set } from './sources.js';
4142
import * as e from '../errors.js';
@@ -142,7 +143,7 @@ function create_effect(type, fn, sync, push = true) {
142143
effect.first === null &&
143144
effect.nodes_start === null &&
144145
effect.teardown === null &&
145-
(effect.f & EFFECT_HAS_DERIVED) === 0;
146+
(effect.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;
146147

147148
if (!inert && !is_root && push) {
148149
if (parent_effect !== null) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
throw new Error();
3+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { flushSync } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
html: '<button></button><div>0</div>',
6+
mode: ['client'],
7+
test({ assert, target }) {
8+
let btn = target.querySelector('button');
9+
let div = target.querySelector('div');
10+
11+
flushSync(() => {
12+
btn?.click();
13+
});
14+
15+
assert.equal(div?.innerHTML, `1`);
16+
}
17+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script>
2+
import Child from "./Child.svelte"
3+
4+
let count = $state(0);
5+
</script>
6+
7+
<button onclick={()=>count++}></button>
8+
<svelte:boundary>
9+
<Child />
10+
11+
{#snippet failed()}
12+
<div>{count}</div>
13+
{/snippet}
14+
</svelte:boundary>

0 commit comments

Comments
 (0)