-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ensure reactive graph is fully traversed in the marking phase fo…
…r 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 <[email protected]> Co-authored-by: Dominic Gannaway <[email protected]>
- Loading branch information
1 parent
cf6b64c
commit d776e52
Showing
6 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: ensure reactive graph is fully traversed in the marking phase for non-runes mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ages/svelte/tests/runtime-legacy/samples/store-updated-in-reactive-statement/Child.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
18 changes: 18 additions & 0 deletions
18
packages/svelte/tests/runtime-legacy/samples/store-updated-in-reactive-statement/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>'); | ||
} | ||
}); |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/runtime-legacy/samples/store-updated-in-reactive-statement/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
3 changes: 3 additions & 0 deletions
3
packages/svelte/tests/runtime-legacy/samples/store-updated-in-reactive-statement/state.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { writable } from 'svelte/store'; | ||
|
||
export const store = writable({ value: 0 }); |