Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression: transitions not playing on route change if element inside {#if} or {#each} block #11081

Closed
kinglouie opened this issue Nov 19, 2023 · 2 comments

Comments

@kinglouie
Copy link

kinglouie commented Nov 19, 2023

Describe the bug

In my svelte application i have some pages with fetched data that is displayed in an {#each} block. Each fetched element has a fade in and out transition. When navigating to/from the page, the transitions should play, but they don't.

This worked fine on my last project running:
svelte: 3.55.0
kit: 1.0.0-next.589

On a brand new project this does not work anymore so there seems to be a regression, also found this issue that may be related

Reproduction

https://codesandbox.io/p/sandbox/crazy-roentgen-qlksjz

To see the issue, click on the test menu item, both text paragraphs on that page should play the in/out transitions, but only one does.

Logs

No response

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M2 Pro
    Memory: 277.20 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 117.0.5938.132
    Safari: 17.0
  npmPackages:
    @sveltejs/adapter-node: ^1.3.1 => 1.3.1 
    @sveltejs/kit: ^1.27.4 => 1.27.6 
    svelte: ^4.0.5 => 4.2.5 
    vite: ^4.4.2 => 4.5.0

Severity

blocking an upgrade

Additional Information

No response

@kinglouie kinglouie changed the title regression: transitions not playing when element inside {#if} or {#each} block regression: transitions not playing on route change if element inside {#if} or {#each} block Nov 19, 2023
@Conduitry
Copy link
Member

This sounds like the breaking change between Svelte 3 and Svelte 4 where transitions switched from being global by default to being local by default. (sveltejs/svelte#8632 - https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG-pre-5.md#major-changes) You can get the old behavior by marking the transition as |global - https://learn.svelte.dev/tutorial/global-transitions

@kinglouie
Copy link
Author

Ahh I missed that one while searching the changelogs for this issue, thanks a lot for solving my issue! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants