-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: unset batch before flushing queued effects #16482
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
+298
−92
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b8893f9
- add state changes resulting from an $effect to a separate new batch
dummdidumm 26f46ba
test
dummdidumm 1ca795b
Merge branch 'main' into async-fixes
dummdidumm 0c0662b
better fix
dummdidumm 4cb4847
tests
dummdidumm 9e54e9a
this fixes the last test somehow
dummdidumm 23b44ce
fix #16477
Rich-Harris ab740c9
Merge branch 'async-fixes' into async-fixes-2
Rich-Harris 09357ae
typo
Rich-Harris a77ee84
copy over changeset from #16477
Rich-Harris 72f8bfe
copy over changeset from #16464
Rich-Harris 0ead782
changeset
Rich-Harris f92dfc1
dedupe
Rich-Harris a6d4644
move flushing_sync check inside Batch.ensure
Rich-Harris f686355
unused
Rich-Harris a98c75e
flushing_sync -> is_flushing_sync
Rich-Harris 457b849
remove flush_effects method
Rich-Harris f1f34f7
dedupe declaration
Rich-Harris 10b2d64
tweak
Rich-Harris 6c2f0f9
tweak
Rich-Harris 82e431f
update comment — it _does_ feel slightly wrong, but no wronger than t…
Rich-Harris 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: keep input in sync when binding updated via effect |
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: prevent infinite async loop |
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: exclude derived writes from effect abort and rescheduling |
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
7 changes: 7 additions & 0 deletions
7
packages/svelte/tests/runtime-runes/samples/1000-reading-derived-effects/Component.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,7 @@ | ||
<script> | ||
const der = $derived(false); | ||
|
||
$effect(() => { | ||
der | ||
}); | ||
</script> |
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-runes/samples/1000-reading-derived-effects/_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,5 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
async test() {} | ||
}); |
8 changes: 8 additions & 0 deletions
8
packages/svelte/tests/runtime-runes/samples/1000-reading-derived-effects/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,8 @@ | ||
<script> | ||
import Component from './Component.svelte'; | ||
const arr = Array.from({length: 10001}); | ||
</script> | ||
|
||
{#each arr} | ||
<Component /> | ||
{/each} |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we've been hunting infinite loop problem in our code in 5.35.5 I am wondering if this comment means that there were indeed a possibility that svelte creates them? That'd be a relief to know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should only happen in case of async though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly! Will be interested to see if this version fixes things