stackiva / slate-collaborate-support

0 stars 0 forks source link

Animations not working #14

Closed PaddyMann closed 2 years ago

PaddyMann commented 3 years ago

We have a number of components that animate when they open and close.

However, when we integrate with slate-collaborate, the animations stop working: https://www.loom.com/share/41c470cffd0549408c720d88def2eddb

I realize that it would be helpful to have some code to help reproduce the issue, but am wondering if you have any immediate insights into what's causing the issue and how we might be able to fix it?

wleroux commented 3 years ago

This isn't really an issue with the collaborative code specifically. It's an issue with the virtual tree being re-created... hence the animation is reset and it is, by default, 'true' after the reset (post animation).

The solution is to properly ensure that the document tree is preserved (either through memoization, keys, should-updates, etc).

If you could create a minimal example of the issue, I could show you how to resolve the issue. I had something similar with an editor that would pop open a new modal when clicked, but that's on a different library (same base concept though).

wleroux commented 2 years ago

Hello @PaddyMann , if you can provide an environment that replicates your issue, I can help with the resolution of this issue. Without specific knowledge on which library you use for animations, I cannot provide you with more information that would resolve your specific issue.

From my experience in the matter, this is an issue with the react tree reconciliation recreating the node unnecessarily.