Skip to content

Commit 0f2d50d

Browse files
committed
Refactor table header and filter row keys in EnhancedTable and TaskAnalysisTable
1 parent f0ceb47 commit 0f2d50d

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/components/TableShared/EnhancedTable.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export const SearchFilter = ({ value, onChange, placeholder, inputClassName = ""
6161
export const renderTableHeader = (headerGroups) => {
6262
return (
6363
<>
64-
{headerGroups.map((headerGroup) => (
65-
<tr {...headerGroup.getHeaderGroupProps()} key={headerGroup.id}>
64+
{headerGroups.map((headerGroup, index) => (
65+
<tr {...headerGroup.getHeaderGroupProps()} key={`header-row-${headerGroup.id || index}`}>
6666
{headerGroup.headers.map((column) => {
6767
const headerProps = column.getHeaderProps();
6868
const sortByProps = column.getSortByToggleProps ? column.getSortByToggleProps() : {};
@@ -76,7 +76,7 @@ export const renderTableHeader = (headerGroups) => {
7676

7777
return (
7878
<th
79-
key={column.id}
79+
key={`header-cell-${column.id}`}
8080
className={`${headerStyles} ${!column.disableSortBy ? sortableHeaderStyles : ""}`}
8181
{...headerProps}
8282
onClick={onHeaderClick}
@@ -130,11 +130,11 @@ export const renderTableHeader = (headerGroups) => {
130130
))}
131131

132132
{/* Add a separate row for filters */}
133-
{headerGroups.map((headerGroup) => (
134-
<tr key={`filter-${headerGroup.id}`}>
133+
{headerGroups.map((headerGroup, index) => (
134+
<tr key={`filter-row-${headerGroup.id}-${index}`}>
135135
{headerGroup.headers.map((column) => (
136136
<td
137-
key={`filter-${column.id}`}
137+
key={`filter-cell-${column.id}`}
138138
style={{
139139
width: column.width,
140140
minWidth: column.minWidth,

src/components/TaskAnalysisTable/TaskAnalysisTable.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export const TaskAnalysisTableInternal = (props) => {
305305
</tr>
306306

307307
{row.isExpanded ? (
308-
<tr>
308+
<tr key={`expanded-${row.original.id}`}>
309309
<td colSpan={columns.length}>
310310
<ViewTaskSubComponent taskId={row.original.id} />
311311
</td>

0 commit comments

Comments
 (0)