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.

InfiniteLoader with FlexTable doesn't work correctly

See original GitHub issue

I tried the demo with the InfiniteLoader using a VirtualScroll and it posed no problems. But when I exchanged the VirtualScroll with the FlexTable it results in an unexpected behaviour. It seems to start loading the items but doesn’t rerender the items until I scroll again. This gif shows the issue: image When you initialize the list, it’ll say loading forever. No matter how long you wait. But as soon as you start scrolling, the loaded date will be rendered) vs expected behavior (using VirtualScroll): image Code using FlexTable:

import * as React from 'react'
import {AutoSizer, InfiniteLoader, FlexColumn, FlexTable} from 'react-virtualized'

interface Props {
  model: any
}

export default class InifiniteTable extends React.Component<Props, {}> {
  list = [
      { name: 'Brian Vaughn', description: 'Software engineer', loaded: false },
      { name: 'John Doe', description: 'PM', loaded: false },
  ];

  constructor() {
    super()
    for (let i = 0; i < 3000000; i++) {
      this.list.push({ name: 'John Doe', description: 'PM', loaded: false })
    }
  }

  loadMoreRows = ({startIndex, stopIndex}) => {
    console.log(`loading more rows ${startIndex} - ${stopIndex}`)
    return new Promise(
      (resolve) =>
          setTimeout(() => {
            for (let i = startIndex; i < stopIndex; i++) {
              this.list[i].loaded = true
            }
            resolve(this.list.slice(startIndex, stopIndex))
          }, 1000)
    )
  }

  render() {
    let width = 408 / this.props.model.fields.edges.length
    return (
      <div style={{height: '100%'}}>
        <InfiniteLoader
          rowCount={this.list.length}
          isRowLoaded={({index}) => this.list[index].loaded}
          loadMoreRows={this.loadMoreRows}
        >
          {({onRowsRendered, registerChild}) => (
          <AutoSizer>
            {({width, height}) => (
            <FlexTable
              ref={registerChild}
              width={width}
              height={height}
              onRowsRendered={onRowsRendered}
              headerHeight={30}
              rowHeight={30}
              rowCount={this.list.length}
              rowGetter={({index}) => this.list[index].loaded ? this.list[index] : ({name: 'loading', description: 'loading'})}
            >
              <FlexColumn label='Name' dataKey='name' width={width / 2} />
              <FlexColumn label='Description' dataKey='description' width={width / 2} />
            </FlexTable>
            )}
          </AutoSizer>
          )}
        </InfiniteLoader>
      </div>
    )
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
bvaughncommented, Aug 29, 2016

Check out release 7.22.1 ~ should be fixed for you 😄

Thanks for the nice bug report.

2reactions
bvaughncommented, Aug 29, 2016

In either way, the fix is easy (despite being a bit hackish). I’ll add some tests and inline comments explaining the reasoning…then I should be able to deploy. If not before lunch, then sometime this afternoon. I’ll ping this issue again once the fix is live.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Virtualized Infinite Loader Not Scrolling Through ...
The FlexTable didn't rerender a row when the data changed until I started scrolling. but the data is there before and it should...
Read more >
Chapter 4 Rendering | Using the flextable R package
When working in RStudio, flextable will be printed in the rstudio viewer pane, the default format is HTML output. flextable objects can be...
Read more >
react-virtualized - UNPKG
36, Fixed edge-case bug where `InfiniteLoader` did not respect ... FlexTable__Grid` classes to fix edge-case scrollbar bug experienced by some users.
Read more >
react-virtualized | Yarn - Package Manager
This supports special use-cases where deferred measuring is not desired. Added estimatedRowSize property to FlexTable and VirtualScroll to be passed through to ...
Read more >
bvaughn/react-virtualized - Gitter
@jpollard-cs You can use CellMeasurer and InfiniteLoader together, ... If your total rowCount is activities + contributions, then that should work.
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