Fix loading album studio page with react-window

pull/4226/head
Bogdan 1 year ago
parent 897357ff31
commit 6a65539ae6

@ -52,9 +52,10 @@ class AlbumStudio extends Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
this.scrollerRef = React.createRef();
this.state = { this.state = {
estimatedRowSize: 100, estimatedRowSize: 100,
scroller: null,
jumpBarItems: { order: [] }, jumpBarItems: { order: [] },
scrollIndex: null, scrollIndex: null,
jumpCount: 0, jumpCount: 0,
@ -111,13 +112,6 @@ class AlbumStudio extends Component {
} }
} }
//
// Control
setScrollerRef = (ref) => {
this.setState({ scroller: ref });
};
setJumpBarItems() { setJumpBarItems() {
const { const {
items, items,
@ -325,7 +319,6 @@ class AlbumStudio extends Component {
allSelected, allSelected,
allUnselected, allUnselected,
estimatedRowSize, estimatedRowSize,
scroller,
jumpBarItems, jumpBarItems,
scrollIndex scrollIndex
} = this.state; } = this.state;
@ -348,7 +341,7 @@ class AlbumStudio extends Component {
<div className={styles.pageContentBodyWrapper}> <div className={styles.pageContentBodyWrapper}>
<PageContentBody <PageContentBody
registerScroller={this.setScrollerRef} ref={this.scrollerRef}
className={styles.contentBody} className={styles.contentBody}
innerClassName={styles.innerContentBody} innerClassName={styles.innerContentBody}
> >
@ -363,13 +356,16 @@ class AlbumStudio extends Component {
} }
{ {
!error && isPopulated && !!items.length && !error &&
isPopulated &&
!!items.length &&
this.scrollerRef.current ?
<div className={styles.contentBodyContainer}> <div className={styles.contentBodyContainer}>
<VirtualTable <VirtualTable
items={items} items={items}
scrollIndex={scrollIndex} scrollIndex={scrollIndex}
columns={columns} columns={columns}
scroller={scroller} scroller={this.scrollerRef.current}
isSmallScreen={isSmallScreen} isSmallScreen={isSmallScreen}
overscanRowCount={5} overscanRowCount={5}
rowRenderer={this.rowRenderer} rowRenderer={this.rowRenderer}
@ -391,7 +387,8 @@ class AlbumStudio extends Component {
estimatedRowSize={estimatedRowSize} estimatedRowSize={estimatedRowSize}
onRecompute={this.onGridRecompute} onRecompute={this.onGridRecompute}
/> />
</div> </div> :
null
} }
{ {

@ -30,7 +30,6 @@ class UnmappedFilesTable extends Component {
this.scrollerRef = React.createRef(); this.scrollerRef = React.createRef();
this.state = { this.state = {
scroller: null,
allSelected: false, allSelected: false,
allUnselected: false, allUnselected: false,
lastToggled: null, lastToggled: null,

Loading…
Cancel
Save