-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Transition within component prevents component unmount #6812
Comments
@jonom - If you add the |local modifier it fixes/works around this problem. Before: <p transition:fade>I shouldn't be readable (for long)!</p> After: <p transition:fade|local>I shouldn't be readable (for long)!</p> This is likely related to #6686 (which also affects transitions on SvelteKit pages). I agree with that issue that |
@techniq thanks for the workaround!! |
I have a bunch of conditionally rendered components with animations in them and other child components. This resulted in double sections of UI rendering where there should just be one. It was an absolute pain to debug, and I only found this thanks to a colleague who remembered this issue. In my case this was a UI breaking bug. If |
I have similar issue with the structure of my web app resembling this: It was impossible to unmount the Thanks to you i used instead |
I have a similar problem, but I wasn't able to solve it myself by just adding the <script>
export let features: Array<Features>;
</script>
{#each features as feature}
{#if $activeFeatureId == feature.id}
<!-- Adding |local here didn't help -->
<div transition:slide>
<table class="w-full text-sm" cols={2}>
<tbody>
{#if feature.properties.type === "CAVITY"}
<!-- FeaturePropertyRow creates two <td> elements -->
<FeaturePropertyRow name="Depth" value={feature.properties.height} unit="mm" />
<FeaturePropertyRow
name="Min Corner Radius"
value={feature.properties.wallCornerRadiuses}
unit="mm"
/>
<FeaturePropertyRow
name="Min Bottom Radius"
value={feature.properties.bottomCornerRadiuses}
unit="mm"
/>
...many more features
{:else if feature.properties.type === "PLANAR"}
<FeaturePropertyRow name="Depth" value={feature.properties.height} unit="mm" />
{/if}
</tbody>
</table>
</div>
{/if}
{/each}
The The problem that I have, is that whenever I do this change, the feature properties of type "CAVITY" (which were shown before) stay visible, so they don't get unmounted. See this video as an example. When I remove Unfortunately, I wasn't able to create a small REPL to easily demonstrate the problem. |
This should be fixed in 3.57.0 - https://svelte.dev/repl/36132eb6293843bf99a5427b14c26f82?version=3.57.0 |
Hmm, at least in my case the issue is still present, even though I'm not 100% sure if it's related to the bug that's reported here :/ |
` |local modifier is now by default on all animations in [email protected]. check it out |
Hey @major-mayer 👋, I believe that after a long time, you may have already solved it, but recently I just had the same problem and almost basically the same as your code, basically the transitions must have a key and in your case you don't have any key in the |
Hi @0rangeFox, |
Describe the bug
It seems that a transition on an element within a component can prevent the component from destroying, if the element is transitioned in right before unmount.
I noted some existing issues with similar symptoms but the conditions seemed quite different to me so I opted to open a new issue - hope that's okay.
BTW going through the Svelte tutorials blew my mind just as much as React did when I first learned it. It will be hard to go back to a React project now. Thank you for all your hard work! ❤️
Reproduction
I've tried to demonstrate and describe the issue in detail here: https://svelte.dev/repl/36132eb6293843bf99a5427b14c26f82?version=3.43.1
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: