framer / motion

Open source, production-ready animation and gesture library for React
https://framer.com/motion
MIT License
22.57k stars 749 forks source link

[BUG] Animating already exiting elements causes them not to unmount #2673

Open WerdoxDev opened 1 month ago

WerdoxDev commented 1 month ago

1. Read the FAQs 👇 done 2. Describe the bug

Lets say we have a swap animation using AnimatePresence and it animates the swapping of 2 divs. now when div a is entering and div b is exiting and I trigger the swapping again, it forgets to remove the now exiting div a. or sometimes it works correctly but the next time triggering the animation both elements show up at the same time.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codesandbox.io/p/sandbox/framer-motion-bug-rmgdpz

4. Steps to reproduce

Click "change" Then click it again while both elements are animating. It all breaks

5. Expected behaviour

Simply exit and unmount the exited element

quentinlagache commented 1 month ago

Bug related to the opacity property since version 11.0.11. Duplicate issue of: #2618 #2554 #2416

Would be great for @mattgperry to be able to look into it 🙏

pklada commented 2 weeks ago

Pls 🙏