Skip to content

Commit

Permalink
fix: address intro transition bugs (#9528)
Browse files Browse the repository at this point in the history
* fix: address intro transition bugs

* fix: address intro transition bugs
  • Loading branch information
trueadm authored Nov 18, 2023
1 parent 298da65 commit b0588d7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
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
2 changes: 2 additions & 0 deletions packages/svelte/src/internal/client/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
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

1 comment on commit b0588d7

@vercel
Copy link

@vercel vercel bot commented on b0588d7 Nov 18, 2023

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

Please sign in to comment.