-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle intro global transition propagation correctly (#9515)
* fix: stop propagating global intros * fix: stop propagating global intros * add test
- Loading branch information
Showing
4 changed files
with
55 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: do not propagate global intro transitions |
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
25 changes: 25 additions & 0 deletions
25
packages/svelte/tests/runtime-legacy/samples/key-block-transition-global/_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,25 @@ | ||
import { flushSync } from '../../../../src/main/main-client'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
html: '<div>0</div><button>toggle</button>', | ||
async test({ assert, component, target, raf }) { | ||
component.value = 2; | ||
|
||
const [button] = /** @type {NodeListOf<HTMLButtonElement>} */ ( | ||
target.querySelectorAll('button') | ||
); | ||
|
||
raf.tick(0); | ||
|
||
assert.htmlEqual(target.innerHTML, '<div>2</div><button>toggle</button>'); | ||
|
||
flushSync(() => { | ||
button.click(); | ||
}); | ||
|
||
raf.tick(0); | ||
|
||
assert.htmlEqual(target.innerHTML, '<button>toggle</button>'); | ||
} | ||
}); |
22 changes: 22 additions & 0 deletions
22
packages/svelte/tests/runtime-legacy/samples/key-block-transition-global/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,22 @@ | ||
<script> | ||
export let value = 0; | ||
export let toggle = true; | ||
function foo(node, params) { | ||
return { | ||
duration: 100, | ||
tick: (t, u) => { | ||
node.foo = t; | ||
node.oof = u; | ||
} | ||
}; | ||
} | ||
</script> | ||
|
||
{#if toggle} | ||
{#key value} | ||
<div in:foo|global>{value}</div> | ||
{/key} | ||
{/if} | ||
|
||
<button on:click={() => toggle = !toggle}>toggle</button> |
f886bc1
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.
Successfully deployed to the following URLs:
svelte-5-preview – ./sites/svelte-5-preview
svelte-octane.vercel.app
svelte-5-preview-svelte.vercel.app
svelte-5-preview.vercel.app
svelte-5-preview-git-main-svelte.vercel.app