Skip to content

Commit

Permalink
refactor: use constants for table.getRowModel().rows
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlo-skumenko committed Aug 12, 2024
1 parent e15465a commit 78ab825
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/ui/data-table/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ interface DataTableProps<TData> {
}

export function DataTable<TData>({ table, columnsLength }: DataTableProps<TData>) {
const tableRows = table.getRowModel().rows;

return (
<div className="space-y-4">
<DataTableToolbar table={table} />
Expand All @@ -30,8 +32,8 @@ export function DataTable<TData>({ table, columnsLength }: DataTableProps<TData>
))}
</TableHeader>
<TableBody>
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row) => (
{tableRows?.length ? (
tableRows.map((row) => (
<TableRow key={row.id} data-state={row.getIsSelected() && 'selected'}>
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>
Expand Down

0 comments on commit 78ab825

Please sign in to comment.