Open LeaVerou opened 4 months ago
as one that has been using MO forever (polyfills included) I never even thought the leaky records would be a problem but I fully agree with this issue concerns and I also need to likely update all my libraries heavily based on MO to guarantee something not observed anymore won't be processed after a disconnect
happens.
Thanks for considering this bug and raising its importance too, if needed.
What problem are you trying to solve?
Calling
mutationObserver.disconnect()
while forgetting to handle any pending records is a common footgun.What solutions exist today?
Having to write boilerplate like:
Every time you want to stop observing is quite repetitive, and it cannot be done with just a reference to the mutation observer, since it requires a reference to its callback too.
How would you solve it?
Add a dictionary argument to
disconnect()
with aflush
option (name TBB) that does exactly this.Anything else?
No response