fix: address intro transition bugs (#9528)

* fix: address intro transition bugs

* fix: address intro transition bugs
pull/9530/head
Dominic Gannaway 1 year ago committed by GitHub
parent 298da65ed6
commit b0588d7888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: address intro transition bugs

@ -1399,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 {
@ -1410,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 {

@ -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))
) {
@ -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();

@ -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);

@ -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);

Loading…
Cancel
Save