Skip to content

Commit

Permalink
Merge pull request #3252 from bettyblocks/fix/properly-display-error-…
Browse files Browse the repository at this point in the history
…message-data-table-PFR-727

fix: properly display error msg in data table header PFR-727
  • Loading branch information
JorisPannekeet authored Nov 16, 2023
2 parents 0f2ca78 + 5f2e7a7 commit 6c0d0e6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/dataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,22 @@
};

const renderTableHead = () => {
if ((loading && !loadOnScroll) || error) {
if (loading && !loadOnScroll) {
return Array.from(Array(children.length).keys()).map((colIdx) => (
<TableCell key={colIdx}>
<div className={classes.skeleton}>
{error && displayError && error.message}
</div>
<div className={classes.skeleton} />
</TableCell>
));
}

if (error) {
return (
<TableCell colSpan={children.length}>
{error && displayError && error.message}
</TableCell>
);
}

return (
<Children headerOnly handleSort={handleSort} orderBy={orderBy}>
{children}
Expand Down

0 comments on commit 6c0d0e6

Please sign in to comment.