You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using onMount and onCleanup lifecycle hooks inside MyComponent.
If I open and dismiss the offcanvas drawer repeatedly, I notice the onMount hook firing on every open. But the onCleanup hook doesn't fire on every dismiss. It only fires when I route away from the entire page.
And it fires multiple instances of onCleanup (equal to the number of times I opened the modal), which means each instance of opening the Offcanvas is mounting a new component and it stays around, never getting cleaned up until we leave the page.
This is a memory leak and leads to a laggy UI after a while of normal usage (which involves many opening/closings of the Offcanvas).
The text was updated successfully, but these errors were encountered:
Thanks for addressing this !
The fix does seem to work correctly. I've got the new behavior working in a minimal sample here - See console logs for Home mounted / unmounted.
I'm using the Offcanvas component like the following :
I am using
onMount
andonCleanup
lifecycle hooks insideMyComponent
.If I open and dismiss the offcanvas drawer repeatedly, I notice the onMount hook firing on every open. But the onCleanup hook doesn't fire on every dismiss. It only fires when I route away from the entire page.
And it fires multiple instances of onCleanup (equal to the number of times I opened the modal), which means each instance of opening the Offcanvas is mounting a new component and it stays around, never getting cleaned up until we leave the page.
This is a memory leak and leads to a laggy UI after a while of normal usage (which involves many opening/closings of the Offcanvas).
The text was updated successfully, but these errors were encountered: