Skip to content

Commit 2cb27c5

Browse files
authored
fix: handle with undefined value of row and column in issue position,… (#932)
1 parent 87e22cd commit 2cb27c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/containers/Tenant/Query/Issues/Issues.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {ArrowToggle, Button, Icon} from '@gravity-ui/uikit';
1212
import ShortyString from '../../../../components/ShortyString/ShortyString';
1313
import type {ErrorResponse, IssueMessage} from '../../../../types/api/query';
1414
import {cn} from '../../../../utils/cn';
15+
import {isNumeric} from '../../../../utils/utils';
1516

1617
import type {SEVERITY} from './models';
1718
import {getSeverity} from './models';
@@ -163,14 +164,13 @@ function IssueSeverity({severity}: {severity: SEVERITY}) {
163164
);
164165
}
165166

166-
function getIssuePosition(issue: IssueMessage) {
167-
const {position = {}} = issue;
168-
169-
if (!position) {
170-
return false;
167+
function getIssuePosition(issue: IssueMessage): string {
168+
const {position} = issue;
169+
if (typeof position !== 'object' || position === null || !isNumeric(position.row)) {
170+
return '';
171171
}
172172

173-
const {file, row, column} = position;
173+
const {row, column} = position;
174174

175-
return `${file ? 'file:' : ''}${row}:${column}`;
175+
return isNumeric(column) ? `${row}:${column}` : `line ${row}`;
176176
}

0 commit comments

Comments
 (0)