You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a <svelte:component> tag is used inside of a element with a svelte transition (like in the code below) and the this prop is changed while the transition is playing then the old component will stay mounted alongside the new one.
Clicking on the Confirm button three times causes all three of the added components to eventually be removed.
Clicking on Open once, then Confirm once, then clicking on Open again, causes the "Bar" component to be replaced by Foo, so that there are two Foo components open. And then you have to click Confirm three more times, four in total, and then all four components (two Foos, a Bar, and another Foo) are removed.
If you add a console.log call to the cleanup() function and then click Confirm three times, you'll see that cleanup() is called three times, at the time you'd expect. If you add an onDestroy call to the Foo and Bar components and log "Destroying Foo" and "Destroying Bar" respectively, then you'll see that "Destroying Foo" is printed only once, and "Destroying Bar" is never printed, even when all three components are removed from the page.
Removing transition:fade does indeed fix the issue; you see the cleanup() function log to the console followed by "Destroying Foo", then another cleanup() function logged to the console followed by "Destroying Bar", then finally one more cleanup() function followed by "Destroying Foo".
Describe the bug
If a
<svelte:component>
tag is used inside of a element with a svelte transition (like in the code below) and thethis
prop is changed while the transition is playing then the old component will stay mounted alongside the new one.Edit: This behavior also seems to occur if a there is a transition inside the component that is provided to the
this
prop.Reproduction
https://svelte.dev/repl/c3000501dc154b88b93cf37c58b350b7?version=3.43.0
To reproduce click the Open button followed by clicking the Confirm buttons.
Only one component should be visible at a time but all components stay mounted.
Remove
transition:fade
inContainer.svelte
to get the proper behavior.Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: