Cannot read property 'DOMNodeInsertedByJs' of undefined
Hi,
I'm getting this error a fair amount in production, specifically on Chrome Mobile from Android 6.0 and 7.1 devices: "Cannot read property 'DOMNodeInsertedByJs' of undefined", happening right here: https://github.com/atomic-app/react-svg/blob/master/src/index.js#L47, after this call: https://github.com/atomic-app/react-svg/blob/master/src/index.js#L66
Here's the full stacktrace:
TypeError Uncaught TypeError: Cannot read property 'DOMNodeInsertedByJs' of undefined
<anonymous>:1:6816 HTMLDocument.DOMNodeInsertedFunc
webpack:///~/react-svg/lib/index.js:76 e.u.value
webpack:///~/react-svg/lib/index.js:92 e.u.value
webpack:///~/react-dom/lib/ReactCompositeComponent.js:614 w.updateComponent
webpack:///~/react-dom/lib/ReactCompositeComponent.js:547 w.receiveComponent
webpack:///~/react-dom/lib/ReactReconciler.js:125 Object.i.receiveComponent
webpack:///~/react-dom/lib/ReactChildReconciler.js:109 Object.c.updateChildren
webpack:///~/react-dom/lib/ReactMultiChild.js:213 h.v.Mixin._reconcilerUpdateChildren
webpack:///~/react-dom/lib/ReactMultiChild.js:312 h.v.Mixin._updateChildren
I assume it has to do with some specifics around Chrome Mobile element insertion -- would it be save to just guard against this.container being falsy in the same way we do with removeSVG, assuming that componentWillReceiveProps will successfully call it subsequently?
Actually, I'm seeing this in IE11 too, it was just grouped as Unable to get property 'removeChild' of undefined or null reference
Hey @ianlyons. Yea I think guarding it is the simplest thing to do for now: Do you want to review/try out PR #54 to see if it fixes your bugs? (Note that I'm being a bit lazy and haven't tried to recreate this locally yet).
@ianlyons any feedback on this stuff? ☝️I'mThinking I'll just release that PR over the weekend...
@ianlyons merged and released as 2.2.15. I'll close this issue, but if things still don't look right then feel free to post back here.
@tanem sorry for the delay, been busy with other stuff -- I'll bump our version on Monday and report back sometime next week.
Cheers! Thanks for being a great package owner!