-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Describe the problem
When the condition of an {#if}/{:else} is updated, the content of the blocks are removed/added into the DOM.
But the order of the blocks are not preserved during transitions : the new visible block is always added after the previous visible block.
I think it would make more sense to preserve the order of the if/else.
Exemple : Push the button toggle and wait for the end of the transition. Push it again and the if block will pop from the bottom.
https://svelte.dev/playground/hello-world?version=5.15.0#H4sIAAAAAAAACp1Sy27bMBD8FZYOEAtxYqePQxVJQNFL-w11DxS5FAhTpECu3LiC_r0kJdl5XgodJC1nZ3aHM1DDWqA5_QFaW_LHOi3IGoRCEBndUKk0eJr_GiieuoiLhVCfu7513Z0_gsZYq5mHt-rcGgSDgYYWnjvVYbU3e1RtZx2SgXitBJCRSGdbcj21bdEx4xUqa64jWAOSo_Kq1kBKcuWRIazR9ZA9hOMACCIeie1ihw-QQfSOxZ-c3O92uzHAiu1F3RR1j2gNsYZrxQ_lsM7KalYoP8wfY4W2aTQU2wmdOoeVksssY5QuhDqSy7x52qcc5llG4vGkIa8ZPzTO9kaUe7qqmZT8654mJ4IXMhFtA1OoDDlo___cUtafaha4I8uZc6vkmKxKT5Eak_psxDBNIpTvNDvlpNaWHx6mYseEUKbJye7uC7TkHtr5oGWuUWapsx5tOkijx8ln0to6AS7cRPdIvA0rkBXn_CX5R3fmlSEyt179hWdVhEe8ZVo1QZGHRIFb1MLVLvuYkLgIpHmMx7h5J7nfg1uB4M30vjp7J8ExlDxiL5HcLXm8AimB43qdkbJafJhCeghwD_gzahyZniGJ6OZmk-KaTXgH2DtDZoAG5s5Nh2zafXq9Cnc1JL4xJLd6ed_LNE9M_jx7_MTK5zb-Hv8Bcz2ulioEAAA=
Describe the proposed solution
Technically the solution seems simple, since it would be enough to change this line :
| consequent_effect = branch(() => fn(anchor)); |
consequent_effect = branch(() => fn(alternate_effect?.nodes_start ?? anchor));But it changes the behavior and I don't know how to estimate the impact of that.
Importance
nice to have