Skip to content

Svelte 5: Element being re-mounted when input transition is changed within an #if block #9932

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

Closed
Thiagolino8 opened this issue Dec 16, 2023 · 7 comments · Fixed by #10162 or #10163
Closed
Assignees

Comments

@Thiagolino8
Copy link

Describe the bug

If an element inside an #if block has its intro transition changed after being mounted (either with the in: or transition: directive) the intro transition is executed again and the action also runs again (but only the first time the transition changes after the element is mounted)
msedge_6SQGpCIBMi

Reproduction

Reproduction

Logs

No response

System Info

App.svelte (Svelte v5.0.0-next.25)

Severity

blocking an upgrade

@trueadm trueadm self-assigned this Dec 17, 2023
@trueadm
Copy link
Contributor

trueadm commented Dec 17, 2023

Thanks, I'll take a look when I'm back after the holidays :)

@Thiagolino8
Copy link
Author

The transition has been fixed but the action is still re-executed

@svelte-kit-so-good
Copy link

What in the modular-ternaries is that example 😅? Could've just used an array.

@trueadm
Copy link
Contributor

trueadm commented Jan 14, 2024

@svelte-kit-so-good Not sure I really understand what is going on there, it's a bit hard to follow.

@svelte-kit-so-good
Copy link

svelte-kit-so-good commented Jan 14, 2024

@trueadm .. eh the comment wasn't really constructive anyway ... just a difference in taste. Does this make it easier to follow?.

Edit: oh actually in the example I just gave why does the text inside the {#if} block only update once?

@trueadm
Copy link
Contributor

trueadm commented Jan 14, 2024

@svelte-kit-so-good I don't see any issue here? Maybe I'm missing something. How does that work in Svelte 4?

@svelte-kit-so-good
Copy link

svelte-kit-so-good commented Jan 14, 2024

@trueadm ...oh it looks like if you change 'transition' to 'in' then it's fixed ... unsure if that's a bug:

- <p use:log transition:current>
+ <p use:log in:current>

Edit: yea it's not svelte5 specific. In both svelte4 and svelte5 the text updates once if using 'transition', otherwise it updates as expected if using 'in' 🤷‍♀️

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