Repository navigation
Commit 4ff0b72
fix: prevent duplicate MutationObserver when autoAnimate called twice (#234)
When autoAnimate() is called multiple times on the same element (e.g., in
React StrictMode which renders components twice), a new MutationObserver
was being created each time. This caused child-added animations to fail
because multiple observers were interfering with each other.
Now we check if a MutationObserver already exists for the element before
creating a new one. This ensures idempotent behavior when autoAnimate()
is called repeatedly on the same element.
Fixes #232
Co-authored-by: Kai Gritun <kai@kaigritun.com>1 parent 624d9c1 commit 4ff0b72
1 file changed
Lines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
912 | | - | |
913 | | - | |
914 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
915 | 917 | | |
916 | 918 | | |
917 | 919 | | |
| |||


0 commit comments