dillon1000/react

Commit

Remove event listeners from native dom wrapper components

Not removing them resulted in leaks as we would hold on to removed nodes forever.

This really showed up with images and the load event where we would unmount and create a new img with the same react id as the old one. We properly cleared and primed the caches but we would handle the load event for both nodes. We would eventually hit an invariant in that path as we tried to handle the event for the removed node, which no longer matched the node we had in the cache.

By forcefully removing the listener, we'll avoid this problem entirely and we should leak fewer DOM nodes.
Browse files
Changed paths4 files
First-parent comparison
M src/browser/ReactEventEmitter.js ModifiedA src/browser/ui/dom/components/LocalEventTrapMixin.js AddedM src/browser/ui/dom/components/ReactDOMForm.js ModifiedM src/browser/ui/dom/components/ReactDOMImg.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…