diff --git a/webapp/src/components/table/tableRows.test.tsx b/webapp/src/components/table/tableRows.test.tsx
index 66ba68c9c..de2204798 100644
--- a/webapp/src/components/table/tableRows.test.tsx
+++ b/webapp/src/components/table/tableRows.test.tsx
@@ -74,6 +74,7 @@ describe('components/table/TableRows', () => {
addCard={addCard}
onCardClicked={jest.fn()}
onDrop={jest.fn()}
+ useVirtualizedList={false}
/>
,
diff --git a/webapp/src/components/table/tableRows.tsx b/webapp/src/components/table/tableRows.tsx
index 7bf44a78d..4e3282120 100644
--- a/webapp/src/components/table/tableRows.tsx
+++ b/webapp/src/components/table/tableRows.tsx
@@ -1,8 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useCallback} from 'react'
-import {FixedSizeList, ListChildComponentProps} from 'react-window';
-import AutoSizer from 'react-virtualized-auto-sizer';
+import {FixedSizeList, ListChildComponentProps} from 'react-window'
+import AutoSizer from 'react-virtualized-auto-sizer'
import {Card} from '../../blocks/card'
import {Board} from '../../blocks/board'
@@ -23,21 +23,50 @@ type Props = {
addCard: (groupByOptionId?: string) => Promise
onCardClicked: (e: React.MouseEvent, card: Card) => void
onDrop: (srcCard: Card, dstCard: Card) => void
+ useVirtualizedList: boolean
}
const TableRows = (props: Props): JSX.Element => {
- const {board, cards, activeView} = props
+ const {board, cards, activeView, useVirtualizedList} = props
const onClickRow = useCallback((e: React.MouseEvent, card: Card) => {
props.onCardClicked(e, card)
}, [props.onCardClicked])
+ if (!useVirtualizedList) {
+ return (
+ <>
+ {cards.map((card, idx) => {
+ return (
+
+ )
+ })}
+ >
+ )
+ }
+
const isItemLoaded = (index: number) => {
return index < cards.length;
- };
+ }
const Item = ({index, style}: ListChildComponentProps) => {
-
const card = cards[index]
if (isItemLoaded(index)) {
return (
@@ -72,13 +101,13 @@ const TableRows = (props: Props): JSX.Element => {
}
return (
-
- {({height, width}) => (
+
+ {({height}) => (
{Item}