Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e.target.className.indexOf is not a function #1203

Closed
dmydry opened this issue Aug 28, 2018 · 5 comments · Fixed by #1210
Closed

e.target.className.indexOf is not a function #1203

dmydry opened this issue Aug 28, 2018 · 5 comments · Fixed by #1210
Labels

Comments

@dmydry
Copy link
Contributor

dmydry commented Aug 28, 2018

Unfortunately I can't make a working repro. This is a main reason of this issue.

In our production code we often get client errors with the next traceback:
TypeError: e.target.className.indexOf is not a function.

Apparently this is the next code: https://github.com/bvaughn/react-virtualized/blob/master/source/vendor/detectElementResize.js#L73

Browser occurrences are quite different (last chrome is in top). Hence it's not a browser issue.

We use WindowScroller, AutoSizer and List components with quite standart props and behaviour.

        <WindowScroller>
          {({ height, isScrolling, scrollTop }) => (
            <AutoSizer disableHeight>
              {({ width }) => (
                <List
                  isScrolling={isScrolling}
                  overscanRowCount={3}
                  scrollTop={scrollTop}
                  autoHeight
                  height={height}
                  rowCount={listCount}
                  rowHeight={rowHeight}
                  rowRenderer={this.rowRenderer}
                  width={width}
                />
              )}
            </AutoSizer>
          )}
        </WindowScroller>

Could anyone give me a tip, what is a possible reason of this issue?

React 16.4.1
React DOM 16.4.1
react-virtualized 9.20.1
@wuweiweiwu wuweiweiwu added the bug label Sep 4, 2018
@wuweiweiwu
Copy link
Contributor

I'm guessing that className is returning a null or undefined.

A fix would be to check that e.target and e.target.className exists

@dmydry
Copy link
Contributor Author

dmydry commented Sep 5, 2018

@wuweiweiwu thats right and I guess I will do a fork after a while. I just prefer to use the original package source if possible.
Just asked if anyone got the same issue. And if so, maybe we just should add an extra checks for a e.target.className and typeof e.target.className.indexOf === 'function'. This should broke nothing but fix the issue.

@wuweiweiwu
Copy link
Contributor

@dmydry would you be interested in submitting a pull request for this?

@dmydry
Copy link
Contributor Author

dmydry commented Sep 6, 2018

@wuweiweiwu done ;)

I didn't find any tests for the detectElementResize listeners.
Will be happy to dive deeper into the project and cover if possible.

@wuweiweiwu
Copy link
Contributor

@dmydry Awesome! thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants