Skip to content

Commit

Permalink
fix: code scanning issues is fixed (SigNoz#3522)
Browse files Browse the repository at this point in the history
  • Loading branch information
palashgdev authored Sep 11, 2023
1 parent 41f7a79 commit 86c34bd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
8 changes: 8 additions & 0 deletions frontend/src/container/ErrorDetails/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const keyToExclude = [
'exceptionStacktrace',
'exceptionType',
'errorId',
'timestamp',
'exceptionMessage',
'exceptionEscaped',
];
19 changes: 3 additions & 16 deletions frontend/src/container/ErrorDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import { useQuery } from 'react-query';
import { useLocation } from 'react-router-dom';
import { PayloadProps as GetByErrorTypeAndServicePayload } from 'types/api/errors/getByErrorTypeAndService';

import { keyToExclude } from './config';
import { DashedContainer, EditorContainer, EventContainer } from './styles';

function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
const { idPayload } = props;
const { t } = useTranslation(['errorDetails', 'common']);
const { search } = useLocation();
const { search, pathname } = useLocation();

const params = useMemo(() => new URLSearchParams(search), [search]);

Expand Down Expand Up @@ -70,18 +71,6 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
[],
);

const keyToExclude = useMemo(
() => [
'exceptionStacktrace',
'exceptionType',
'errorId',
'timestamp',
'exceptionMessage',
'exceptionEscaped',
],
[],
);

const { notifications } = useNotifications();

const onClickErrorIdHandler = async (
Expand All @@ -102,9 +91,7 @@ function ErrorDetails(props: ErrorDetailsProps): JSX.Element {
errorId: id,
};

history.replace(
`${history.location.pathname}?${createQueryParams(queryParams)}`,
);
history.replace(`${pathname}?${createQueryParams(queryParams)}`);
} catch (error) {
notifications.error({
message: t('something_went_wrong'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from 'react';
import { useTranslation } from 'react-i18next';
import { connect, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { bindActionCreators } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import { DeleteWidget } from 'store/actions/dashboard/deleteWidget';
Expand Down Expand Up @@ -62,6 +63,7 @@ function WidgetGraphComponent({
const [hovered, setHovered] = useState(false);
const { notifications } = useNotifications();
const { t } = useTranslation(['common']);
const { pathname } = useLocation();

const { graphVisibilityStates: localstoredVisibilityStates } = useMemo(
() =>
Expand Down Expand Up @@ -195,11 +197,7 @@ function WidgetGraphComponent({
graphType: widget?.panelTypes,
widgetId: uuid,
};
setTimeout(() => {
history.push(
`${history.location.pathname}/new?${createQueryParams(queryParams)}`,
);
}, 1500);
history.push(`${pathname}/new?${createQueryParams(queryParams)}`);
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import createQueryParams from 'lib/createQueryParams';
import history from 'lib/history';
import { CSSProperties, useCallback } from 'react';
import { connect, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { bindActionCreators, Dispatch } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
import {
Expand All @@ -24,6 +25,8 @@ function DashboardGraphSlider({ toggleAddWidget }: Props): JSX.Element {
(state) => state.dashboards,
);

const { pathname } = useLocation();

const { notifications } = useNotifications();

const [selectedDashboard] = dashboards;
Expand Down Expand Up @@ -51,16 +54,14 @@ function DashboardGraphSlider({ toggleAddWidget }: Props): JSX.Element {
),
};

history.push(
`${history.location.pathname}/new?${createQueryParams(queryParams)}`,
);
history.push(`${pathname}/new?${createQueryParams(queryParams)}`);
} catch (error) {
notifications.error({
message: 'Something went wrong',
});
}
},
[data, toggleAddWidget, notifications],
[data, toggleAddWidget, notifications, pathname],
);
const isDarkMode = useIsDarkMode();
const fillColor: CSSProperties['color'] = isDarkMode ? 'white' : 'black';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/actions/trace/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const updateURL = (
userSelectedFilter: JSON.stringify(Object.fromEntries(userSelectedFilter)),
};
history.replace(
`${history.location.pathname}?${createQueryParams(queryParams)}`,
`${window.location.pathname}?${createQueryParams(queryParams)}`,
);
};

Expand Down

0 comments on commit 86c34bd

Please sign in to comment.