[ML] Explain Log Rate Spikes: Fix key attribute for grouped analysis results table (#156038)

Fixes the React dev mode warning "Warning: Each child in a list should
have a unique "key" prop. Check the render method of EuiBasicTable" by
putting the `key` attribute for a group item on the outer level.
This commit is contained in:
Walter Rafelsberger 2023-05-02 09:07:04 +02:00 committed by GitHub
parent 7b947188f2
commit a3f5a340ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,12 +189,8 @@ export const SpikeAnalysisGroupsTable: FC<SpikeAnalysisTableProps> = ({
const { fieldName, fieldValue, duplicate } = groupItem;
if (valuesBadges.length >= MAX_GROUP_BADGES) break;
valuesBadges.push(
<>
<EuiBadge
key={`${fieldName}-id`}
data-test-subj="aiopsSpikeAnalysisTableColumnGroupBadge"
color="hollow"
>
<span key={`${fieldName}-id`}>
<EuiBadge data-test-subj="aiopsSpikeAnalysisTableColumnGroupBadge" color="hollow">
<span>
{(duplicate ?? 0) <= 1 ? '* ' : ''}
{`${fieldName}: `}
@ -202,7 +198,7 @@ export const SpikeAnalysisGroupsTable: FC<SpikeAnalysisTableProps> = ({
<span style={{ color: visColors[2] }}>{`${fieldValue}`}</span>
</EuiBadge>
<EuiSpacer size="xs" />
</>
</span>
);
}