question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot read property 'firstElementChild' of undefined

See original GitHub issue

Hi! 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:open
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bvaughncommented, Mar 3, 2017

Thanks for the additional info, @PhilippSpo. Fixes welcome if you get the time to dig into this 😄

0reactions
karatechopscommented, Mar 14, 2018

@rhagigi have you successfully reproduced this? If so could you please provide steps?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'firstElementChild ...
I'm trying to write a post expansion feature for my site, and for some reason whenever I expand the first post, the second...
Read more >
Uncaught TypeError: Cannot read property ... - GitHub
Error messages: "Uncaught TypeError: Cannot read property 'firstElementChild' of undefined," , when I run "let subjectRow = term.
Read more >
TypeError: Cannot read property 'firstChild' of Null in JS
The "Cannot read property 'firstChild' of null" error occurs when trying to access the firstChild property on a null value. Variables that store...
Read more >
Element.firstElementChild - Web APIs - MDN Web Docs
The Element.firstElementChild read-only property returns an element's first child Element, or null if there are no child elements.
Read more >
HTML DOM Element firstElementChild Property - W3Schools
The firstElementChild property is read-only. The firstElementChild property returns the same as children[0]. ... null if no child element exists.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found