Skip to content

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

@WerdoxDev

Description

@WerdoxDev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions