xxttt
xxttt
SSolidJS
Created by xxttt on 7/12/2024 in #support
Cleanup function
https://stackblitz.com/edit/solidjs-templates-unzazc?file=src%2FuseFloating.tsx 1. When you hover over the box, you'll see three console logs with the message "Update." 2. If you scroll while your mouse is over the box, you'll notice that it's reacting and automatically updating. This is because the autoUpdate function with the elementResize option returns a ResizeObserver. 3. When you move the mouse away from the box and try to scroll the page, you'll see that there are no more logs. This indicates that the cleanup has occurred. The question is: Why does the update function get invoked three times? I believe the issue might be in the second createEffect. I tried to implement cleanup at the first level, but it didn't work well. Is there a way to improve this behavior? I treid to make cleanup fn for days, but I just don't understand where is the problem now. Thanks!
19 replies