diff --git a/.changeset/shiny-shrimps-march.md b/.changeset/shiny-shrimps-march.md new file mode 100644 index 0000000000..a6920fae3e --- /dev/null +++ b/.changeset/shiny-shrimps-march.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: do not propagate global intro transitions diff --git a/packages/svelte/src/internal/client/transitions.js b/packages/svelte/src/internal/client/transitions.js index 4413af63c9..b07db93359 100644 --- a/packages/svelte/src/internal/client/transitions.js +++ b/packages/svelte/src/internal/client/transitions.js @@ -460,7 +460,8 @@ export function bind_transition(dom, transition_fn, props_fn, direction, global) ); transition = create_transition(dom, init, direction, transition_effect); - const show_intro = !skip_intro && (direction === 'in' || direction === 'both'); + const is_intro = direction === 'in'; + const show_intro = !skip_intro && (is_intro || direction === 'both'); if (show_intro) { transition.payload = transition.init(); @@ -484,6 +485,7 @@ 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)) ) { diff --git a/packages/svelte/tests/runtime-legacy/samples/key-block-transition-global/_config.js b/packages/svelte/tests/runtime-legacy/samples/key-block-transition-global/_config.js new file mode 100644 index 0000000000..0b24498670 --- /dev/null +++ b/packages/svelte/tests/runtime-legacy/samples/key-block-transition-global/_config.js @@ -0,0 +1,25 @@ +import { flushSync } from '../../../../src/main/main-client'; +import { test } from '../../test'; + +export default test({ + html: '