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; block.current = result;
if (has_mounted) { if (has_mounted) {
if (result) { if (result) {
remove_in_transitions(alternate_transitions);
if (alternate_transitions.size === 0) { if (alternate_transitions.size === 0) {
execute_effect(alternate_effect); execute_effect(alternate_effect);
} else { } else {
@ -1410,6 +1411,7 @@ function if_block(anchor_node, condition_fn, consequent_fn, alternate_fn) {
trigger_transitions(consequent_transitions, 'in'); trigger_transitions(consequent_transitions, 'in');
} }
} else { } else {
remove_in_transitions(consequent_transitions);
if (consequent_transitions.size === 0) { if (consequent_transitions.size === 0) {
execute_effect(consequent_effect); execute_effect(consequent_effect);
} else { } else {

@ -485,7 +485,6 @@ export function bind_transition(dom, transition_fn, props_fn, direction, global)
} }
if ( if (
parent === null || parent === null ||
is_intro ||
(!global && (!global &&
(transition_block.type !== IF_BLOCK || parent.type !== IF_BLOCK || parent.current)) (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; const direction = transition.direction;
if (target_direction === 'in') { if (target_direction === 'in') {
if (direction === 'in' || direction === 'both') { if (direction === 'in' || direction === 'both') {
if (direction === 'in') {
transition.cancel();
}
transition.in(); transition.in();
} else { } else {
transition.cancel(); transition.cancel();

@ -35,9 +35,9 @@ export default test({
component.visible = true; component.visible = true;
raf.tick(100); raf.tick(100);
assert.equal(divs[0].foo, 0.3); assert.equal(divs[0].foo, 1);
assert.equal(divs[1].foo, 0.3); assert.equal(divs[1].foo, 1);
assert.equal(divs[2].foo, 0.3); assert.equal(divs[2].foo, 1);
assert.equal(divs[0].bar, 1); assert.equal(divs[0].bar, 1);
assert.equal(divs[1].bar, 1); assert.equal(divs[1].bar, 1);

@ -14,7 +14,7 @@ export default test({
raf.tick(500); raf.tick(500);
component.x = true; component.x = true;
assert.equal(component.no, target.querySelector('div')); assert.equal(component.no, null);
assert.equal(component.yes.foo, undefined); assert.equal(component.yes.foo, undefined);
raf.tick(700); raf.tick(700);

Loading…
Cancel
Save