Skip to content

Commit

Permalink
memoize itemCount and itemData and fix header table height (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bianca Del Carretto committed Jun 28, 2020
1 parent 420276a commit 7ed7afc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/DomEventsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,15 @@ const DomEventsTable = ({
</IconButton>
);

const [itemCount, itemData] = useMemo(() => {
const eventsFiltered = data.filter(filterData);
return [eventsFiltered.length, eventsFiltered];
}, [data, filterData]);

return (
<div className="editor p-4 md:h-56 flex-auto overflow-hidden">
<div className="h-56 md:h-full w-full flex flex-col">
<div className="h-8 flex items-center w-full text-sm font-bold">
<div className="h-10 flex items-center w-full text-sm font-bold">
<div
className="p-2 w-16 cursor-pointer flex justify-between items-center"
onClick={onChangeSortDirection}
Expand Down Expand Up @@ -214,8 +219,8 @@ const DomEventsTable = ({
mode={appendMode}
ref={listRef}
height={height}
itemCount={data.filter(filterData).length}
itemData={data.filter(filterData)}
itemCount={itemCount}
itemData={itemData}
itemSize={32}
width={width}
outerElementType={VirtualScrollable}
Expand Down

0 comments on commit 7ed7afc

Please sign in to comment.