Skip to content

Commit 0200545

Browse files
authored
fix 3 no-key warnings when no actions are provided to the table (#391)
1 parent 01d7bd9 commit 0200545

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/components/tableV2/netdataTable.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import React, { useEffect, useMemo, useRef, useState } from "react"
44
import Table, { Pagination } from "./base-table"
55

66
import {
7+
flexRender,
78
getCoreRowModel,
89
getFilteredRowModel,
910
getPaginationRowModel,
1011
getSortedRowModel,
11-
flexRender,
1212
useReactTable,
1313
} from "@tanstack/react-table"
1414

@@ -127,6 +127,7 @@ const NetdataTable = ({
127127

128128
const makeColumnVisibilityAction = useMemo(
129129
() => ({
130+
id: "columnVisibility",
130131
handleAction: () => setIsColumnDropdownVisible(true),
131132
visible: enableColumnVisibility,
132133
icon: "gear",
@@ -556,7 +557,7 @@ const renderActions = ({ actions, testPrefix }) => {
556557
}
557558

558559
const renderBulkActions = ({ bulkActions, table, testPrefix, selectedRows }) => {
559-
if (!bulkActions || !bulkActions.length) return <Box aria-hidden as="span" />
560+
if (!bulkActions || !bulkActions.length) return <Box aria-hidden as="span" key="empty-box" />
560561
return bulkActions.map(
561562
({ id, icon, handleAction, tooltipText, alwaysEnabled, isDisabled, isVisible, ...rest }) => {
562563
const disabled = typeof isDisabled === "function" ? isDisabled() : isDisabled
@@ -661,11 +662,10 @@ const renderActionWithDropdown = ({
661662
const actionRef = useRef()
662663

663664
return (
664-
<>
665+
<React.Fragment key={id}>
665666
<Action
666667
ref={actionRef}
667668
testPrefix={`-bulk${testPrefix}`}
668-
key={id}
669669
visible={visible}
670670
id={id}
671671
icon={icon}
@@ -682,7 +682,7 @@ const renderActionWithDropdown = ({
682682
columns={table.getAllLeafColumns()}
683683
onClose={onClose}
684684
/>
685-
</>
685+
</React.Fragment>
686686
)
687687
}
688688
)

0 commit comments

Comments
 (0)