Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-needles-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: address intro transition bugs
3 changes: 2 additions & 1 deletion packages/svelte/src/internal/client/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
EACH_IS_CONTROLLED,
EACH_INDEX_REACTIVE,
EACH_ITEM_REACTIVE,
EACH_IS_ANIMATED,
PassiveDelegatedEvents,
DelegatedEvents
} from '../../constants.js';
Expand Down Expand Up @@ -1400,6 +1399,7 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
block.current = result;
if (has_mounted) {
if (result) {
remove_in_transitions(alternate_transitions);
if (alternate_transitions.size === 0) {
execute_effect(alternate_effect);
} else {
Expand All @@ -1411,6 +1411,7 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
trigger_transitions(consequent_transitions, 'in');
}
} else {
remove_in_transitions(consequent_transitions);
if (consequent_transitions.size === 0) {
execute_effect(consequent_effect);
} else {
Expand Down
4 changes: 0 additions & 4 deletions packages/svelte/src/internal/client/transitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ export function bind_transition(dom, transition_fn, props_fn, direction, global)
}
if (
parent === null ||
is_intro ||
(!global &&
(transition_block.type !== IF_BLOCK || parent.type !== IF_BLOCK || parent.current))
) {
Expand Down Expand Up @@ -530,9 +529,6 @@ export function trigger_transitions(transitions, target_direction, from) {
const direction = transition.direction;
if (target_direction === 'in') {
if (direction === 'in' || direction === 'both') {
if (direction === 'in') {
transition.cancel();
}
transition.in();
} else {
transition.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export default test({
component.visible = true;

raf.tick(100);
assert.equal(divs[0].foo, 0.3);
assert.equal(divs[1].foo, 0.3);
assert.equal(divs[2].foo, 0.3);
assert.equal(divs[0].foo, 1);
assert.equal(divs[1].foo, 1);
assert.equal(divs[2].foo, 1);

assert.equal(divs[0].bar, 1);
assert.equal(divs[1].bar, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default test({

raf.tick(500);
component.x = true;
assert.equal(component.no, target.querySelector('div'));
assert.equal(component.no, null);
assert.equal(component.yes.foo, undefined);

raf.tick(700);
Expand Down