Skip to content

Commit

Permalink
fix: display react-table empty row correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Jun 21, 2023
1 parent 50740e3 commit 443f62e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/component/elements/ReactTable/ReactTable.tsx
Expand Up @@ -272,8 +272,8 @@ const ReactTableInner = forwardRef(function ReactTableInner(
onClick={headerClickHandler}
/>
<tbody {...getTableBodyProps()}>
{!rowsData ||
(rowsData?.length === 0 && (
{!data ||
(data?.length === 0 && (
<EmptyDataRow columns={columns} text={emptyDataRowText} />
))}
{rowsData.map((row, index) => {
Expand Down Expand Up @@ -332,7 +332,7 @@ const ReactTableInner = forwardRef(function ReactTableInner(
{enableColumnsVirtualScroll && typeof startColumn === 'string' && (
<span style={{ left: 0 }}>{`Column ${startColumn}`} </span>
)}
{index + 1} / {total}
{typeof index === 'number' ? index + 1 : total} / {total}
</p>
)}
</>
Expand Down Expand Up @@ -400,7 +400,7 @@ function ReactTable(props: ReactTableProps) {

function lookForGroupIndex(currentIndex: number, side: 1 | -1) {
const currentItem = data[currentIndex];
if (currentItem.index && groupKey) {
if (currentItem?.index && groupKey) {
switch (side) {
case -1: {
let index = currentIndex - 1;
Expand Down

0 comments on commit 443f62e

Please sign in to comment.