Skip to content

Commit

Permalink
fix: prefer to use url from meta instead of suiteUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowusr committed Aug 5, 2024
1 parent 4584b67 commit 06d68d8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/static/components/icons/view-in-browser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import classNames from 'classnames';
import {Eye, EyeSlash} from '@gravity-ui/icons';

import * as actions from '../../../modules/actions';
import {getUrlWithBase} from '../../../../common-utils';
import {getRelativeUrl, getUrlWithBase} from '../../../../common-utils';

import './index.styl';

Expand Down Expand Up @@ -41,7 +41,7 @@ class ViewInBrowser extends Component {
return (
<a
className={className}
href={getUrlWithBase(suiteUrl, baseHost)}
href={getUrlWithBase(getRelativeUrl(suiteUrl), baseHost)}
onClick={this.onViewInBrowser}
title="view in browser"
target="_blank"
Expand All @@ -53,8 +53,10 @@ class ViewInBrowser extends Component {

export default connect(
({tree, view}, {resultId}) => {
const result = tree.results.byId[resultId];

return {
suiteUrl: tree.results.byId[resultId].suiteUrl,
suiteUrl: result.metaInfo?.url ?? result.suiteUrl,
baseHost: view.baseHost
};
},
Expand Down

0 comments on commit 06d68d8

Please sign in to comment.