Error: Cannot read property 'firstElementChild' of undefined
See original GitHub issueHi! First off, big thanks for this library. It’s awesome, and it was very easy for us to integrate with.
Since we’ve gone live with a site using react-virtualized we sometimes see an error occuring that says Cannot read property 'firstElementChild' of undefined
where the call stack is only from react-virtualized
. The call stack looks like this:
at firstElementChild line 47, column 0 (webpack:///./~/react-virtualized/dist/commonjs/vendor/detectElementResize.js:47)
var triggers = element.__resizeTriggers__,
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild; // <-- This line
contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + 'px';
at resetTriggers line 142, column 0 (webpack:///./~/react-virtualized/dist/commonjs/vendor/detectElementResize.js:142)
/* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName == animationName) resetTriggers(element); <-- This line
});
}
element.__resizeListeners__.push(fn);
I’ve never seen this error myself, and unfortunately I have no idea how to reproduce it. I’m guessing this error occurs when you scroll and then navigate so that we’re removing the virtual scroll elements at the same time that the resetTriggers
function is called.
The last error we got about this happened on Android 5.0 with Chrome 34.0.1847.76. I’ll update this issue if I see if occuring in other browsers.
Please let me know if there’s anything I can do to help out with this issue.
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
Thanks for the additional info, @PhilippSpo. Fixes welcome if you get the time to dig into this 😄
@rhagigi have you successfully reproduced this? If so could you please provide steps?