Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Animate Presence Items Persist if Removed During Another Item's Active Exit Animation #1914

Closed
spiicy-sauce opened this issue Jan 27, 2023 · 3 comments 路 Fixed by #2113
Labels
bug Something isn't working

Comments

@spiicy-sauce
Copy link

spiicy-sauce commented Jan 27, 2023

Hopefully I'm just misunderstanding some aspect of the AnimatePresence API, but this was unexpected behavior for me working off the docs for AnimatePresence.

1. Read the FAQs 馃憞
Done

2. Describe the bug
AnimatePresence item is never unmounted if its exit is started during the animation of another item.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
Code Sandbox

4. Steps to reproduce

  1. Open the sandbox
  2. Click the "Remove" button three times rapidly (before any of the items is fully removed)

5. Expected behavior
I expect all items to be removed from the DOM. To produce the expected behavior:

  1. Open the sandbox
  2. Click the "Remove" button, waiting for each element to be removed from the page before clicking again.

6. Video or screenshots

Bug

Any items removed during the exit animation fail to be completely removed
CleanShot 2023-01-27 at 11 58 48

Working

Each item animates out if the previous removal completes
CleanShot 2023-01-27 at 11 58 33

7. Environment details
Tested in Firefox. Dependencies are in the sandbox.

@spiicy-sauce spiicy-sauce added the bug Something isn't working label Jan 27, 2023
@spiicy-sauce spiicy-sauce changed the title [BUG] [BUG] Animate Presence Items Persist if Removed During Another Item's Active Exit Animation Jan 27, 2023
@spiicy-sauce
Copy link
Author

Another interesting behavior: this staling effect seems to flush once the original item has exited, and subsequent exits will remove stale items as well.

Eg.
CleanShot 2023-01-27 at 12 03 36

@spiicy-sauce
Copy link
Author

Oh hey, I think this is actually a duplicate of #1769. I didn't see that one until just now.

@ndimatteo
Copy link

I think this may be related to #2023 actually... issues still persist when making changes rapidly.

mattgperry added a commit that referenced this issue May 10, 2023
* use ref for existingChildren

* add test which fails to repro

---------

Co-authored-by: Matt Perry <mattgperry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants