react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

TypeError: Cannot read property 'offset' of undefined

Open lwansbrough opened this issue 10 years ago • 10 comments

When scrolling really fast, the following error can always be reproduced.

It appears to be the result of a floating point issue. I was able to reproduce this both on my iPhone and Chrome.

Maybe just parseInt(...)?

lwansbrough avatar Jun 26 '16 03:06 lwansbrough

I've never seen this, and I've fast-scrolled a lot while testing. Could you tell me more about where you're seeing it? (What app/context? What OS and Chrome version? Which react-virtualized version?)

bvaughn avatar Jun 26 '16 04:06 bvaughn

OSX 10.10.5, Chrome 50.0.2661.102 (64-bit)

Rendering inside a Material UI List.

          <List style={styles.list}>
            <AutoSizer>
              {({ height, width }) => (
                <VirtualScroll
                  height={height}
                  width={width}
                  rowCount={leaderboardList.length}
                  rowHeight={56}
                  rowRenderer={this.renderItem}
                  scrollToIndex={skip}
                  overscanRowCount={5}
                />
              )}
            </AutoSizer>
          </List>

I'm using a custom scroll bar which allows me to scroll from 1 to 10,000 in 100 pixels. (By setting the scrollToIndex={skip} where skip is a percentage of leaderboardList.length (ie. 5000).

lwansbrough avatar Jun 26 '16 04:06 lwansbrough

Related? https://bugs.chromium.org/p/chromium/issues/detail?id=604033

But I also get the issue on Safari 10 on iOS so I don't know.

lwansbrough avatar Jun 26 '16 04:06 lwansbrough

Can you give me a repo case? Plunker would be nice. Git repo would be acceptable as well.

bvaughn avatar Jun 26 '16 04:06 bvaughn

Considering I've never seen this in a vanilla react-virtualized project, it's hard to debug.

bvaughn avatar Jun 26 '16 04:06 bvaughn

I'll see if I can set it up. I suspect rapidly updating that scrollToIndex property will probably trigger the issue.

lwansbrough avatar Jun 26 '16 05:06 lwansbrough

The issue was originating from my application, but thank you for your quick response!

lwansbrough avatar Jun 26 '16 06:06 lwansbrough

Hey no problem. I really appreciate you letting me know and closing the bug. :)

bvaughn avatar Jun 26 '16 15:06 bvaughn

For anyone that comes across this, I found that it was because I was passing a decimal value to the scrollToIndex. Math.round or any other like ceil, or floor fixes this issue.

JesseChrestler avatar Apr 19 '17 19:04 JesseChrestler

Im running into this currently. Very rare. Very frustrated.

wi-ski avatar Sep 18 '17 23:09 wi-ski