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.

Firefox - Empty rows after scroll and data filtering

See original GitHub issue

What is the current behavior?

In Firefox, if you scroll down and then update the table data (by some filter for example), only a subset of the rows will be rendered with blank space in between rows.

Here is the sandbox to reproduce: https://codesandbox.io/s/react-virtualized-5ukgi

It seems to only happen when the table had scrollbars and after the update it no longer needs scrollbars. i.e. All the rows can fit in view.

react-virtualized FF issue

What is the expected behavior?

All filtered rows show display.

I’ve tried to resolve this by forceUpdateGrids on MultiGrid ref, forceUpdate on my component after componentDidUpdate, etc… Nothing seems to work. Note: if there are horizontal scrollbars, and I scroll, it will reveal the

Any workaround would be much appreciated. I don’t think I’ll be able to upgrade at this point. Thanks in advance.

Which versions of React and react-virtualized, and which browser / OS are affected by this issue? Did this work in previous versions of react-virtualized?

Browser Firefox (latest)
OS Windows
React 16.8.6
React DOM 16.8.6
react-virtualized 9.21.0

In the sandbox, it works in react-virtualized 9.7.5 and a few other versions above. I haven’t been able to pinpoint at which version it breaks. I’ll post more info as I go.

Note: I did try downgrading in my environment but it was still broken.

Update

I found that this breaks in Firefox between version 9.18.5 --> 9.19.0 of react-virtualized.

Works: https://codesandbox.io/s/react-virtualized-forked-dcch6 Broken: https://codesandbox.io/s/react-virtualized-forked-n8kks

I’m still trying to debug what caused the issue, but my hunch is that it has to do with the deprecated React lifecycle methods: https://github.com/bvaughn/react-virtualized/blob/9.19.0/CHANGELOG.md

None of the other commits seem to have any breaking changes.

@wuweiweiwu @bvaughn any ideas?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
alxbradleycommented, Apr 4, 2020

@kad3nce In the sandbox code there’s a div wrapper around the AutoSizer component with the class “table-wrapper”. What I did was something like the following,

componentDidUpdate(prevProps, prevState) {
  if (prevProps.data.length > this.props.data.length) {
    this.setState({
      tableKey: this.state.tableKey + 1  // update the key
    });
  }
}

render() {
  return (
    <div
      key={ 'my-table-' + this.state.tableKey }  // <--- a unique key that changes every time the data size is reduced
      className="table-wrapper"
      style={{ display: "flex", flex: 1 }}
    >
      <AutoSizer>{ ... }

The key will force React to re-build the DOM tree, and re-mount the Grid. Hope this helps!

0reactions
alxbradleycommented, Oct 22, 2020

After playing around some more I found that this isn’t an issue in React v16.2.0. Some change in React 16.3.0 seems to have caused this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
Guide to scroll anchoring - CSS: Cascading Style Sheets | MDN
Scroll anchoring is a browser feature that aims to solve this problem of content jumping, which happens if content loads in after the...
Read more >
scroll-behavior - CSS: Cascading Style Sheets - MDN Web Docs
The scroll-behavior CSS property sets the behavior for a scrolling box when scrolling is triggered by the navigation or CSSOM scrolling APIs ...
Read more >
-webkit-overflow-scrolling - CSS: Cascading Style Sheets | MDN
Use "regular" scrolling, where the content immediately ceases to scroll when you remove your finger from the touchscreen. touch. Use momentum- ...
Read more >
scroll-snap-stop - CSS: Cascading Style Sheets | MDN
Values. normal. When the visual viewport of this element's scroll container is scrolled, it may "pass over" possible snap positions ...
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