Skip to content

Commit 8aafa52

Browse files
fix(smi-table): optimize mesh matching logic in TableRow component
1 parent 8d494bd commit 8aafa52

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/SMI-Table/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const TOOLTIP_ID = "smi-table-tooltip";
2121

2222
const TableRow = React.memo(({ row, rowIndex, prepareRow }) => {
2323
const [isCollapsed, setIsCollapsed] = useState(false);
24+
const meshMatch = non_functional.find((ele) => ele.name.includes(row.original.mesh_name));
2425

2526
prepareRow(row);
2627

@@ -34,8 +35,8 @@ const TableRow = React.memo(({ row, rowIndex, prepareRow }) => {
3435
>
3536
<td>
3637
{
37-
(non_functional.find(ele => ele.name.includes(row.original.mesh_name))) ?
38-
<img data-tooltip-id={TOOLTIP_ID} data-tooltip-content={row.original.mesh_name} className="smiMark" src={non_functional.find(ele => ele.name.includes(row.original.mesh_name)).icon} alt="Mesh Icon" />
38+
meshMatch ?
39+
<img data-tooltip-id={TOOLTIP_ID} data-tooltip-content={row.original.mesh_name} className="smiMark" src={meshMatch.icon} alt="Mesh Icon" />
3940
: <img data-tooltip-id={TOOLTIP_ID} data-tooltip-content={"Service Mesh"} className="smiMark" src={ServiceMeshIcon} alt="Service Mesh" />
4041
}
4142
</td>

0 commit comments

Comments
 (0)