The existing conditional API snapshots a removed motion.* element and runs its exit prop on a visual clone.
initial, animate, and exit props. On mount, the real node tweens from initial → animate. On
removal, Svelte destroys that node and AnimatePresence runs animate → exit on its captured clone.AnimatePresence, a Svelte {#if} would
tear the node down immediately and the exit animation would never get a chance
to run. The conditional AnimatePresence form captures a clone before teardown and animates
that detached snapshot.transition applies to all three phases — same spring (stiffness: 300, damping: 25) on the way in and on the way out, so the motion feels symmetric instead of
snappy-in / linear-out.present plus a named child snippet lets AnimatePresence retain the original DOM subtree until its nested motion.* exit completes.
present back to true cancels an in-flight exit and keeps stale completion
callbacks from removing the re-entered node.real DOM node
AnimatePresence owns this childExit completes before this node is removed.
Toggle each lane twice quickly. The conditional form mounts a new node beside an exiting ghost; present={visible} reverses the original node in place.
Rapid re-entry creates a new node while the old clone keeps exiting.
Rapid re-entry reverses the same node and preserves its live state.