motiondivision / motiondivision/motion
[BUG] `AnimatePresence` does not execute exiting animations in sequence during fast renders
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
1. Read the FAQs 👇
✅
2. Describe the bug
Items with an exit animation within the <AnimatePresence /> component do not reliably exit in sequence during fast renders.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/devbox/dreamy-liskov-q35pmx
4. Steps to reproduce
- Click on the 'Add' button a few times in quick succession.
- Notice that the list items that appear below the button exit in a non-sequential order.
5. Expected behavior
The list items should exit in sequential order even during fast renders.
6. Video or screenshots
https://github.com/framer/motion/assets/62209188/d73c8cdc-8cdd-4037-adda-d9cd901c613c
Notice that 'hey 6' jumped above 'hey 5' at the 0:04 second mark, while 'hey 7' disappeared before it's supposed to.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked CodeSandbox reproduction and inspect the AnimatePresence usage; reproduce the issue by clicking Add rapidly and compare the list order with the video. Trace the exit-animation behavior from that example and verify that rapid renders preserve sequential exits, with a regression check if an existing test entry point is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100