-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Transitions are not triggered for the else of an each-else block #4970
Comments
svelte/src/compiler/compile/render_dom/wrappers/EachBlock.ts Lines 307 to 308 in f111cf6
svelte/src/compiler/compile/render_dom/wrappers/EachBlock.ts Lines 323 to 324 in f111cf6
@transition_in(${each_block_else}, 1); I can't rn but you'd just need to insert that line at those two places <script>
export let arr = ["a"];
function foo(node){
return { tick(t){ node.foo = t; }, duration: 100 }
}
</script>
{#each arr as v}
{v}
{:else}
<div transition:foo>empty</div>
{/each} export default {
test({ component, target, assert, raf }){
assert.htmlEqual(target.innerHtml, "a");
component.arr = [];
assert.htmlEqual(target.innerHtml, "<div>empty</div>");
raf.tick(50);
assert.equal(target.querySelector("div").foo, 50);
}
} test for it |
Fixed in 3.24.1 - https://svelte.dev/repl/132758f597224a71a8cd520793fe100f?version=3.24.1 |
Hello @Conduitry , |
Describe the bug
When using an
{#each}
{:else}
block, the contents of the{:else}
block do not trigger transitions.To Reproduce
https://svelte.dev/repl/132758f597224a71a8cd520793fe100f?version=3.23.0
Expected behavior
I expect the behavior to match having a separate
{#if array.length === 0}
block: triggering transitions.Information about your Svelte project:
Severity
Low priority - easy workaround using a separate
{#if}
block.The text was updated successfully, but these errors were encountered: