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

Conditionally animating results in stale DOM #224

Open
afreix opened this issue Mar 13, 2018 · 1 comment
Open

Conditionally animating results in stale DOM #224

afreix opened this issue Mar 13, 2018 · 1 comment

Comments

@afreix
Copy link

afreix commented Mar 13, 2018

I conditionally set enterAnimation/leaveAnimation to false on the FlipMove element. During the same render cycle the children of the FlipMove component are updated as well. This results in the DOM containing extra elements, and another render cycle needs to be initiated before FlipMove removes the extraneous elements from the DOM.

For a simplified example of what's happening imagine a connected component that gets the list elements and a shouldAnimate boolean.

<FlipMove enterAnimation={shouldAnimate} leaveAnimation={shouldAnimate}>{items}</FlipMove>

function mapStateToProps(state) {
  const shouldAnimate = getShouldAnimate(state);
  const items = getListItems(state);

  return {
    items,
    shouldAnimate,
  };
}

I can provide a more complete example if necessary, but I'm mainly wondering if this is expected behavior or if this has happened to anyone else.

@tobilen
Copy link
Collaborator

tobilen commented Mar 15, 2018

DOM cleanup is still somewhat sketchy and kind of lacking in test coverage. if you could provide an example, that would be very helpful, as it would provide something to develop against 👍

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

No branches or pull requests

2 participants