Skip to content

Commit 425fe94

Browse files
Fix errors filters, sorting and affected endpoints (#1376)
2 parents 92f458d + e892404 commit 425fe94

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

src/components/Errors/GlobalErrorsList/GlobalErrorsFilters/useFiltersOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const useFiltersOptions = (
6363
}
6464
},
6565
{
66-
skip: !isEnabled || !selectedServices || selectedServices.length === 0
66+
skip: !isEnabled
6767
}
6868
);
6969

@@ -78,7 +78,7 @@ export const useFiltersOptions = (
7878
}
7979
},
8080
{
81-
skip: !isEnabled || !selectedEndpoints || selectedEndpoints.length === 0
81+
skip: !isEnabled
8282
}
8383
);
8484

src/components/Errors/GlobalErrorsList/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export const GlobalErrorsList = () => {
6969
setGlobalErrorsSearch,
7070
setGlobalErrorsSorting,
7171
setGlobalErrorsPage,
72-
resetGlobalErrors,
7372
resetGlobalErrorsSelectedFilters,
7473
setGlobalErrorsViewMode,
7574
setGlobalErrorsLastDays,
@@ -154,10 +153,8 @@ export const GlobalErrorsList = () => {
154153
!isUndefined(data.dismissedCount) &&
155154
data.dismissedCount > 0;
156155

157-
// Cleanup errors store slice on unmount
158156
useMount(() => {
159157
return () => {
160-
resetGlobalErrors();
161158
window.clearTimeout(animationDelayTimerId.current);
162159
};
163160
});

src/components/Errors/NewErrorCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const NewErrorCard = ({
107107
useEffect(() => {
108108
const option = selectedEndpointKey
109109
? selectorOptions.find((x) => getEndpointKey(x) === selectedEndpointKey)
110-
: undefined;
110+
: selectorOptions[0];
111111

112112
setSelectedEndpointKey(option ? getEndpointKey(option) : undefined);
113113
}, [selectorOptions, selectedEndpointKey]);

src/components/Errors/index.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useEffect, useState } from "react";
22
import { useParams } from "react-router";
33
import { getFeatureFlagValue } from "../../featureFlags";
4+
import { useMount } from "../../hooks/useMount";
45
import { usePersistence } from "../../hooks/usePersistence";
56
import { usePrevious } from "../../hooks/usePrevious";
67
import { useConfigSelector } from "../../store/config/useConfigSelector";
@@ -51,8 +52,11 @@ export const Errors = () => {
5152
const previousErrorDetailsWorkspaceItemsOnly = usePrevious(
5253
errorDetailsWorkspaceItemsOnly
5354
);
54-
const { setErrorDetailsWorkspaceItemsOnly, setGlobalErrorsSelectedFilters } =
55-
useStore.getState();
55+
const {
56+
setErrorDetailsWorkspaceItemsOnly,
57+
setGlobalErrorsSelectedFilters,
58+
resetGlobalErrors
59+
} = useStore.getState();
5660
const spanCodeObjectId = scope?.span?.spanCodeObjectId;
5761
const methodId = scope?.span?.methodId ?? undefined;
5862
const { goTo } = useHistory();
@@ -127,6 +131,13 @@ export const Errors = () => {
127131
isErrorDetailsWorkspaceItemsOnlyRehydrated
128132
]);
129133

134+
// Cleanup errors store slice on unmount
135+
useMount(() => {
136+
return () => {
137+
resetGlobalErrors();
138+
};
139+
});
140+
130141
const handleErrorSelect = (errorId: string) => {
131142
goTo(errorId);
132143
};

src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpaNPlusOneInsightCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const SpaNPlusOneInsightCard = ({
6565
useEffect(() => {
6666
const option = selectedEndpointKey
6767
? selectorOptions.find((x) => getEndpointKey(x) === selectedEndpointKey)
68-
: undefined;
68+
: selectorOptions[0];
6969

7070
setSelectedEndpointKey(option ? getEndpointKey(option) : undefined);
7171
}, [selectorOptions, selectedEndpointKey]);

src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanEndpointBottleneckInsightCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const SpanEndpointBottleneckInsightCard = ({
7272
useEffect(() => {
7373
const newOption = selectedEndpointKey
7474
? selectorOptions.find((x) => getEndpointKey(x) === selectedEndpointKey)
75-
: undefined;
75+
: selectorOptions[0];
7676

7777
setSelectedEndpointKey(newOption ? getEndpointKey(newOption) : undefined);
7878
}, [selectorOptions, selectedEndpointKey]);

0 commit comments

Comments
 (0)