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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing exit variant propagation #346

Merged
merged 2 commits into from Oct 3, 2019
Merged

Fixing exit variant propagation #346

merged 2 commits into from Oct 3, 2019

Conversation

mattgperry
Copy link
Collaborator

Fixes #345

This fixes a regression where exit variants stopped propagating.

Every render, a motion component clears its children, which then each re-subscribe. This is done to ensure we keep the stagger order refreshed in case children change order.

When we remove a child from AnimatePresence we keep it around until all exit animations have completed. We do this by using React.cloneElement - this will re-render the top-level component but its children don't technically rerender. So the top-level component removes all its children but they don't resubscribe, so the exit animation doesn't propagate to them.

This PR adds a check - if this component is exiting, don't unsubscribe its children.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 3, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0f47a44:

Sandbox Source
Framer Motion: Simple animation Configuration

Copy link

@melissarofman melissarofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mattgperry mattgperry added automerge Land this PR and removed automerge Land this PR labels Oct 3, 2019
@mattgperry mattgperry merged commit 46e2550 into master Oct 3, 2019
@mattgperry mattgperry deleted the fix/exit-propagation branch October 3, 2019 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Exit variant not propagated in framer-motion@1.6.8
2 participants