pull/17116/head
Rich Harris 2 weeks ago
parent 3197022471
commit 4d5209c511

@ -610,6 +610,10 @@ export function get(signal) {
} else if (is_derived) {
derived = /** @type {Derived} */ (signal);
if (is_updating_effect && effect_tracking() && (derived.f & CONNECTED) === 0) {
reconnect(derived);
}
if (batch_values?.has(derived)) {
return batch_values.get(derived);
}
@ -617,10 +621,6 @@ export function get(signal) {
if (is_dirty(derived)) {
update_derived(derived);
}
if (is_updating_effect && effect_tracking() && (derived.f & CONNECTED) === 0) {
reconnect(derived);
}
}
if (batch_values?.has(signal)) {

@ -0,0 +1,6 @@
<script>
let { double } = $props();
double; // forces derived into UNOWNED mode
</script>
<p>{double}</p>

@ -0,0 +1,30 @@
import { tick } from 'svelte';
import { test } from '../../test';
export default test({
async test({ assert, target }) {
const button = target.querySelector('button');
button?.click();
await tick();
assert.htmlEqual(
target.innerHTML,
`
<button>1</button>
<p>2</p>
`
);
button?.click();
await tick();
assert.htmlEqual(
target.innerHTML,
`
<button>2</button>
<p>4</p>
`
);
}
});

@ -0,0 +1,19 @@
<script>
import Component from './Component.svelte';
let count = $state(0);
const double = $derived(count * 2);
</script>
<svelte:boundary>
{await new Promise((r) => {
// long enough for the test to do all its other stuff while this is pending
setTimeout(r, 10);
})}
{#snippet pending()}{/snippet}
</svelte:boundary>
<button onclick={() => count += 1}>{count}</button>
{#if count > 0}
<Component {double} />
{/if}
Loading…
Cancel
Save