Hi there
I have noticed that MutationObserver is never disconnected, which in most cases result in the terrible memory performance. Are you planning to address that in the near future? What are your thoughts on that?
Do you have an example to replicate the issue? Can you provide more details please? Thanks
Its in the SRC/index.js.
Find MutationObserver instance. It's there.
yeah, I know where the mutation observer is.
I wonder if you have an example of where it would be an issue.
It's an object so it stays in memory as long as it's referenced by the page like other objects, right?
Have you experienced slowness or other stuff? Do you have any concerns you can explain?Alternatives to provide? etc.
Otherwise it's not clear what the issue refers to so it's hard to understand if it requires a fix or not.
Thanks
P.s. the mutation observer need to run continuously because it's how the author designed the library. it will intercept new elements added to the DOM and instantiate their reactivity.
When you navigate to a different page, the garbage collector will eventually trash the object.
I don't have a concrete example, no. I was just addressing the fact that if the object does not get disconnected, it can cause the issue.
I hope that you understand my concern which is the point of opening this issue.
From MDN::disconnect
If the element being observed is removed from the DOM and then subsequently released by the browser's garbage collection mechanism, the MutationObserver is likewise deleted.
So it shouldn't be needed to manually disconnect.
Thanks @var-che @mblarsen
Are we good to close this issue? Doesn't sound like there's a concrete bug or reproduction case mentioned.
Closing this for now, feel free to reopen if it's actually causing a reproducible issue 馃槃 thanks for the discussion everyone.
Most helpful comment
From MDN::disconnect
So it shouldn't be needed to manually disconnect.