You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a component that renders an AnimatePresence ever suspends, the exit animations don't work again. I'm not talking about animations that get interrupted by a suspense, but animations that happen at any point in time after the AnimatePresence was suspended and then resumed.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
functionApp(){return(<Suspensefallback={<p>Suspended</p>}><MyComponent/></Suspense>);}functionMyComponent(){const[items,setItems]=useState(()=>['alice','bob','carol'].map(name=>({id: crypto.randomUUID(), name })),);return(<ul><AnimatePresence>{items.map(item=>(<motion.likey={item.id}initial={{x: 100}}animate={{x: 0}}exit={{x: -100}}>{item.name}<buttononClick={()=>setItems(items.filter(i=>i!==item))}>
x
</button></motion.li>))}</AnimatePresence><buttononClick={()=>{/* do something that causes MyComponent to suspend */}}>
Suspend
</button></ul>);}
Remove an item, the exit animation works
Cause the component to suspend
Now try removing an item, the exit animation does not work
(The code sandbox is a better demonstration ☝️ )
5. Expected behavior
Exit animations continue to work after the component has resumed after a suspense
1. Read the FAQs 👇
2. Describe the bug
If a component that renders an
AnimatePresenceever suspends, the exit animations don't work again. I'm not talking about animations that get interrupted by a suspense, but animations that happen at any point in time after theAnimatePresencewas suspended and then resumed.3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
Code Sandbox Link
4. Steps to reproduce
Steps to reproduce the behavior:
Consider these components
(The code sandbox is a better demonstration ☝️ )
5. Expected behavior
Exit animations continue to work after the component has resumed after a suspense
6. Video or screenshots
Screen.Recording.2024-05-30.at.4.47.01.PM.mov
7. Environment details