Skip to content

Commit

Permalink
fix: use encodedGroupId to prevent navigation/api calls issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rmyz committed Jan 31, 2025
1 parent 5774e8d commit 15703a8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function ErrorSampler({ errorSampleIds, errorSamplesFetchStatus, occurren
'/mobile-services/{serviceName}/errors-and-crashes/errors/{groupId}',
'/mobile-services/{serviceName}/errors-and-crashes/crashes/{groupId}'
);

const encodedGroupId = encodeURIComponent(groupId);
const { observabilityAIAssistant } = useApmPluginContext();

const { rangeFrom, rangeTo, environment, kuery, errorId } = query;
Expand All @@ -51,7 +51,7 @@ export function ErrorSampler({ errorSampleIds, errorSamplesFetchStatus, occurren
params: {
path: {
serviceName,
groupId,
groupId: encodedGroupId,
errorId,
},
query: {
Expand All @@ -65,7 +65,7 @@ export function ErrorSampler({ errorSampleIds, errorSamplesFetchStatus, occurren
);
}
},
[environment, kuery, serviceName, start, end, groupId, errorId]
[environment, kuery, serviceName, start, end, encodedGroupId, errorId]
);
const onSampleClick = (sample: string) => {
history.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export function ErrorGroupDetails() {
} = useApmParams('/services/{serviceName}/errors/{groupId}');

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

const encodedGroupId = encodeURIComponent(groupId);
useBreadcrumb(
() => ({
title: groupId,
href: apmRouter.link('/services/{serviceName}/errors/{groupId}', {
path: {
serviceName,
groupId,
groupId: encodedGroupId,
},
query: {
rangeFrom,
Expand All @@ -115,6 +115,7 @@ export function ErrorGroupDetails() {
comparisonEnabled,
environment,
groupId,
encodedGroupId,
kuery,
rangeFrom,
rangeTo,
Expand All @@ -131,7 +132,7 @@ export function ErrorGroupDetails() {
params: {
path: {
serviceName,
groupId,
groupId: encodedGroupId,
},
query: {
environment,
Expand All @@ -143,12 +144,12 @@ export function ErrorGroupDetails() {
});
}
},
[environment, kuery, serviceName, start, end, groupId]
[environment, kuery, serviceName, start, end, encodedGroupId]
);

const { errorDistributionData, errorDistributionStatus } = useErrorGroupDistributionFetcher({
serviceName,
groupId,
groupId: encodedGroupId,
environment,
kuery,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function TopErroneousTransactions({ serviceName }: Props) {

const { start, end } = useTimeRange({ rangeFrom, rangeTo });

const encodedGroupId = encodeURIComponent(groupId);
const { data = INITIAL_STATE, status } = useFetcher(
(callApmApi) => {
if (start && end) {
Expand All @@ -51,7 +52,7 @@ export function TopErroneousTransactions({ serviceName }: Props) {
params: {
path: {
serviceName,
groupId,
groupId: encodedGroupId,
},
query: {
environment,
Expand All @@ -66,7 +67,7 @@ export function TopErroneousTransactions({ serviceName }: Props) {
);
}
},
[environment, kuery, serviceName, start, end, groupId, comparisonEnabled, offset]
[environment, kuery, serviceName, start, end, encodedGroupId, comparisonEnabled, offset]
);

const loading = isPending(status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ interface Props extends APMLinkExtendProps {
}

function ErrorDetailLink({ serviceName, errorGroupId, ...rest }: Props) {
return <LegacyAPMLink path={`/services/${serviceName}/errors/${errorGroupId}`} {...rest} />;
return (
<LegacyAPMLink
path={`/services/${serviceName}/errors/${encodeURIComponent(errorGroupId)}`}
{...rest}
/>
);
}

export { ErrorDetailLink };

0 comments on commit 15703a8

Please sign in to comment.