Skip to content

Commit 5bcad0d

Browse files
committed
Use more idomatic code
1 parent 8197183 commit 5bcad0d

File tree

2 files changed

+3
-8
lines changed
  • x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/anomalies

2 files changed

+3
-8
lines changed

x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/anomalies/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ const AnnotationTooltip: React.FunctionComponent<{ details: string }> = ({ detai
190190
{parsedDetails.anomalyScoresByPartition.map(
191191
({ partitionId, maximumAnomalyScore }, index) => {
192192
return (
193-
<li
194-
key={`${index}-overall-anomaly-chart-${partitionId}-partition-score-${maximumAnomalyScore}`}
195-
>
193+
<li key={`overall-anomaly-chart-${partitionId}`}>
196194
<span>
197195
{`${partitionId}: `}
198196
<b>{maximumAnomalyScore}</b>

x-pack/legacy/plugins/infra/public/pages/logs/analysis/sections/anomalies/table.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,8 @@ export const AnomaliesTable: React.FunctionComponent<{
100100
const toggleExpandedItems = useCallback(
101101
item => {
102102
if (itemIdToExpandedRowMap[item.id]) {
103-
const newItemIdToExpandedRowMap = {
104-
...itemIdToExpandedRowMap,
105-
};
106-
delete newItemIdToExpandedRowMap[item.id];
107-
setItemIdToExpandedRowMap(newItemIdToExpandedRowMap);
103+
const { [item.id]: toggledItem, ...remainingExpandedRowMap } = itemIdToExpandedRowMap;
104+
setItemIdToExpandedRowMap(remainingExpandedRowMap);
108105
} else {
109106
const newItemIdToExpandedRowMap = {
110107
...itemIdToExpandedRowMap,

0 commit comments

Comments
 (0)