From 2a55c7c4122fe58996450cbc6808f0b7b4f0e6c7 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Fri, 24 Jan 2025 17:06:39 +0100 Subject: [PATCH] Fix affected endpoints sorting --- .../insightCards/SpaNPlusOneInsightCard/index.tsx | 4 +++- .../insightCards/SpanEndpointBottleneckInsightCard/index.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpaNPlusOneInsightCard/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpaNPlusOneInsightCard/index.tsx index 0f57a63a3..aa6d6069c 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpaNPlusOneInsightCard/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpaNPlusOneInsightCard/index.tsx @@ -46,7 +46,9 @@ export const SpaNPlusOneInsightCard = ({ }: SpaNPlusOneInsightCardProps) => { const endpoints = useMemo( () => - (insight.endpoints ?? []).sort((a, b) => b.occurrences - a.occurrences), + [...(insight.endpoints ?? [])].sort( + (a, b) => b.occurrences - a.occurrences + ), [insight.endpoints] ); diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanEndpointBottleneckInsightCard/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanEndpointBottleneckInsightCard/index.tsx index e2004b590..f57ec8007 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanEndpointBottleneckInsightCard/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanEndpointBottleneckInsightCard/index.tsx @@ -51,7 +51,7 @@ export const SpanEndpointBottleneckInsightCard = ({ const { isJaegerEnabled } = useConfigSelector(); const slowEndpoints = useMemo( () => - (insight.slowEndpoints ?? []).sort( + [...(insight.slowEndpoints ?? [])].sort( (a, b) => b.avgDurationWhenBeingBottleneck.raw - a.avgDurationWhenBeingBottleneck.raw