-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: cleanup old batches, run their still-current commits #16621
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
Open
dummdidumm
wants to merge
8
commits into
main
Choose a base branch
from
boundary-batch-nullpointer-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+152
−40
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e14561c
fix: associate batch with boundary
dummdidumm 0f4d0b1
fix
dummdidumm 0ee1d56
fix memory leak, fix branch commit bug
dummdidumm 5d6b755
belts and braces
dummdidumm bde51cd
typo
Rich-Harris 626b9fc
Merge branch 'main' into boundary-batch-nullpointer-fix
dummdidumm 3ee6ea4
adjust, add test that fails without remove clearing arrays and sets
dummdidumm 28be8c9
unused
dummdidumm 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 obsolete batches are removed and its necessary dom changes committed |
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
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
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
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
36 changes: 36 additions & 0 deletions
36
packages/svelte/tests/runtime-runes/samples/async-redirect-2/_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,36 @@ | ||
import { tick } from 'svelte'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
async test({ assert, logs, target }) { | ||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<h1>a</h1> | ||
<button>a</button> | ||
<button>b</button> | ||
<button>c</button> | ||
<p>a</p> | ||
` | ||
); | ||
|
||
const [a, b] = target.querySelectorAll('button'); | ||
|
||
b.click(); | ||
await tick(); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
` | ||
<h1>c</h1> | ||
<button>a</button> | ||
<button>b</button> | ||
<button>c</button> | ||
<p>c</p> | ||
<p>b or c</p> | ||
` | ||
); | ||
|
||
assert.deepEqual(logs, ['route a', 'route c']); | ||
} | ||
}); |
41 changes: 41 additions & 0 deletions
41
packages/svelte/tests/runtime-runes/samples/async-redirect-2/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,41 @@ | ||
<script lang=ts> | ||
let route = $state('a'); | ||
|
||
function goto(r) { | ||
return Promise.resolve().then(async () => { | ||
route = r; | ||
await Promise.resolve(); | ||
}); | ||
} | ||
|
||
$effect(() => { | ||
console.log('route ' + route); | ||
}); | ||
</script> | ||
|
||
<h1>{route}</h1> | ||
<button onclick={() => route = 'a'}>a</button> | ||
<button onclick={() => route = 'b'}>b</button> | ||
<button onclick={() => route = 'c'}>c</button> | ||
|
||
<svelte:boundary> | ||
{#if route === 'a'} | ||
<p>a</p> | ||
{/if} | ||
|
||
{#if route === 'b'} | ||
{await goto('c')} | ||
{/if} | ||
|
||
{#if route === 'c'} | ||
<p>c</p> | ||
{/if} | ||
|
||
{#if route === 'b' || route === 'c'} | ||
<p>b or c</p> | ||
{/if} | ||
|
||
{#snippet pending()} | ||
<p>pending...</p> | ||
{/snippet} | ||
</svelte:boundary> |
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.
shouldn't this stuff get GC'd along with the rest of the batch?
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.
as said in the meeting, my hunch is that it's possible for obsolete batches to still be called at some point and then we don't want to rerun anything for them.
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.
added a test that would fail without this logic - outdated batches could resolve when they're already destroyed, and could then wrongfully run stuff. Also helps free up memory for never-resolving promises.