Skip to content

Commit 5d0ce2f

Browse files
committed
fix: allow transition undefined payload
1 parent b3d185d commit 5d0ce2f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/svelte/src/internal/client/transitions.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ function create_transition(dom, init, direction, effect) {
279279
// @ts-ignore
280280
payload = payload({ direction: curr_direction });
281281
}
282+
if (payload == null) {
283+
return;
284+
}
282285
const duration = payload.duration ?? 300;
283286
const delay = payload.delay ?? 0;
284287
const css_fn = payload.css;
@@ -485,13 +488,17 @@ export function bind_transition(dom, get_transition_fn, props_fn, direction, glo
485488
const show_intro = !can_show_intro_on_mount && (is_intro || direction === 'both');
486489

487490
if (show_intro) {
488-
transition.p = transition.i();
491+
transition.p = transition.i() || null;
489492
}
490493

491494
const effect = managed_pre_effect(() => {
492495
destroy_signal(effect);
493496
dom.inert = false;
494497

498+
if (transition.p === null) {
499+
return;
500+
}
501+
495502
if (show_intro) {
496503
transition.in();
497504
}
@@ -671,7 +678,7 @@ function each_item_animate(block, transitions, index, index_is_reactive) {
671678
transition.c();
672679
}
673680
}
674-
schedule_task(() => {
681+
queueMicrotask(() => {
675682
trigger_transitions(transitions, 'key', from);
676683
});
677684
}

0 commit comments

Comments
 (0)