fix: never consider inert boundary effects (#14999)

* fix: never consider inert boundary effects

* chore: inline bitwise
pull/14970/head
Paolo Ricciuti 3 days ago committed by GitHub
parent 36ef59df1f
commit 8a1acac084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: never consider inert boundary effects

@ -35,7 +35,8 @@ import {
INSPECT_EFFECT, INSPECT_EFFECT,
HEAD_EFFECT, HEAD_EFFECT,
MAYBE_DIRTY, MAYBE_DIRTY,
EFFECT_HAS_DERIVED EFFECT_HAS_DERIVED,
BOUNDARY_EFFECT
} from '../constants.js'; } from '../constants.js';
import { set } from './sources.js'; import { set } from './sources.js';
import * as e from '../errors.js'; import * as e from '../errors.js';
@ -142,7 +143,7 @@ function create_effect(type, fn, sync, push = true) {
effect.first === null && effect.first === null &&
effect.nodes_start === null && effect.nodes_start === null &&
effect.teardown === null && effect.teardown === null &&
(effect.f & EFFECT_HAS_DERIVED) === 0; (effect.f & (EFFECT_HAS_DERIVED | BOUNDARY_EFFECT)) === 0;
if (!inert && !is_root && push) { if (!inert && !is_root && push) {
if (parent_effect !== null) { if (parent_effect !== null) {

@ -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`);
}
});

@ -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…
Cancel
Save