mirror of https://github.com/sveltejs/svelte
fix: ensure reactive graph is fully traversed in the marking phase for non-runes mode (#13059)
* fix: ensure signal status is set in legacy mode fixes #13051 * add (failing) test * alternative fix * add changeset * alternative fix * add comment --------- Co-authored-by: Rich Harris <rich.harris@vercel.com> Co-authored-by: Dominic Gannaway <dg@domgan.com>pull/13085/head
parent
cf6b64c6c0
commit
d776e522d2
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: ensure reactive graph is fully traversed in the marking phase for non-runes mode
|
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
import { writable } from 'svelte/store';
|
||||
import { store } from './state.js';
|
||||
|
||||
export let value;
|
||||
|
||||
const copy = writable(value);
|
||||
|
||||
$: {
|
||||
copy.set(value);
|
||||
store.set({ value });
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>{$copy}</p>
|
@ -0,0 +1,18 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
import { store } from './state.js';
|
||||
|
||||
export default test({
|
||||
html: '<p>0</p><button>1</button>',
|
||||
|
||||
before_test() {
|
||||
store.set({ value: 0 });
|
||||
},
|
||||
|
||||
async test({ assert, target }) {
|
||||
const button = target.querySelector('button');
|
||||
flushSync(() => button?.click());
|
||||
|
||||
assert.htmlEqual(target.innerHTML, '<p>1</p><button>1</button>');
|
||||
}
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import { store } from './state.js';
|
||||
import Child from './Child.svelte';
|
||||
</script>
|
||||
|
||||
<Child value={$store.value} />
|
||||
|
||||
<button on:click={() => store.set({ value: 1 })}>1</button>
|
@ -0,0 +1,3 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const store = writable({ value: 0 });
|
Loading…
Reference in new issue