tbranyen/diffhtml

release() method unprotects all associated VTrees to a given dom node

tbranyen opened this issue · 2 comments

This is problematic as the DOM node could be actively reused in the new tree that is to be diffed. If we fully clean this up then we are now diffing against a tree in an incorrect state (VTree memory should be protected not free). I found this bug after uncommenting: https://github.com/tbranyen/diffhtml/blob/master/packages/diffhtml/lib/util/memory.js#L36-L37

Running the tests with attributes and childNodes fully reset, bugs should be uncovered. I anticipate in the future this will be configurable behind a flag.

I'm not going to pursue this much further for now. If someone wanted to control memory, they could use the ReleaseHook in middleware to remove the childNodes/attributes. It's too hard to predict and I don't want to implement more complex memory management.

Re-opened and fixed here: #281