-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: ensure signal graph is consistent before triggering $inspect signals #13153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0a4edee
fix: ensure signal graph is consistent before triggering $inspect sig…
trueadm 11b62f6
add test
trueadm 193b5f0
add test
trueadm 9a41440
oops
trueadm 7a34324
oops
trueadm 286104b
oops
trueadm 70351c8
Merge branch 'main' into fix-graph-inconsistency
trueadm ba1cc3b
tweak
trueadm ae52e43
Update packages/svelte/src/internal/client/reactivity/sources.js
trueadm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 signal graph is consistent before triggering $inspect signals |
This file contains hidden or 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
This file contains hidden or 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
16 changes: 16 additions & 0 deletions
16
packages/svelte/tests/runtime-runes/samples/inspect-recursive/_config.js
This file contains hidden or 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,16 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
compileOptions: { | ||
dev: true | ||
}, | ||
|
||
async test({ assert, logs, target }) { | ||
const [btn] = target.querySelectorAll('button'); | ||
btn.click(); | ||
btn.click(); | ||
await Promise.resolve(); | ||
|
||
assert.deepEqual(logs, ['init', [], 'update', [{}], 'update', [{}, {}]]); | ||
} | ||
}); |
35 changes: 35 additions & 0 deletions
35
packages/svelte/tests/runtime-runes/samples/inspect-recursive/main.svelte
This file contains hidden or 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,35 @@ | ||
<script> | ||
class Rect{ | ||
x = $state(); | ||
y = $state(); | ||
|
||
constructor(x, y){ | ||
this.x = x; | ||
this.y = y; | ||
} | ||
} | ||
|
||
class Node{ | ||
pos = $state({ x: 0, y: 0 }); | ||
rect = $derived(new Rect(this.pos.x, this.pos.y)); | ||
|
||
constructor(pos){ | ||
this.pos = pos; | ||
} | ||
} | ||
|
||
const nodes = $state([]); | ||
|
||
const rects = $derived(nodes.map(n => n.rect)); | ||
|
||
$inspect(rects); | ||
</script> | ||
|
||
<button onclick={()=>{ | ||
nodes.push(new Node({x: Math.floor(Math.random()*100), y: Math.floor(Math.random()*100)})); | ||
}}>add</button> | ||
<ul> | ||
{#each rects as rect} | ||
<li>{rect.x} - {rect.y}</li> | ||
{/each} | ||
</ul> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.