-
-
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
Svelte 5: Run outro transition on unmount
#13728
Comments
Is there a workaround to solve this issue? I'd like to use a portal based on So far the only thing that comes to mind is to wrap the contents of the portaral in a condition and switch this condition first, and call |
I'm looking for a way to run transitions without component destruction (assuming I control DOM removal myself). This feature request would greatly help with that. Something like this could be perfect for my use-case: export async function unmount(component: Record<string, any>, options?: { outro?: boolean, destroy?: boolean }): Promise<void>; |
Just saying this would be a fantastic "Svelte advent" feature to deliver and it will bring much rejoicing; this seems like low hanging fruit in terms of implementation. There isn't much possible in constructing a Svelte 5 workaround due to In my larger framework I have been able to remove all other usage of |
https://github.com/sveltejs/svelte/releases/tag/svelte%405.13.0 - it looks like the |
Closed by #14540 |
Thanks so much for looking into this and getting it handled! Even the demo for the feature shows how useful / neat / handy it is... Next up I'm sure I'll be chiming in on some of the new transition / WAAPI areas in terms of refinement, but after I get my larger framework to Svelte 5 so I can put things through the paces so to speak. |
Describe the problem
With Svelte 3 & 4 using a crafty workaround with code example at the end of this issue it is possible to destroy components after outro transitions are run.
Svelte 3&4 related issue: #4056
Is there any comparable
svelte/internal
mechanisms accessible in Svelte 5 to achieve the same result? I have not found a corresponding capability yet in upgrading my framework to Svelte 5. This would be a rather debilitating situation without a solution for various use cases required by my framework.It would be nice if
unmount
in Svelte could take an options object with { outro: boolean } and return a Promise. IE run outro transition, destroy / unmount component and then resolve the Promise.This would make the declaration:
The Svelte 3 & 4 solution to the problem:
Describe the proposed solution
Modify
unmount
to take an options object indicating that the outro transition should run and complete before unmounting returning a Promise. Or provide an alternateunmountWithOutro
function.Importance
i cannot use svelte without it / blocking upgrade to Svelte 5.
The text was updated successfully, but these errors were encountered: