Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Error resource view #1338

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/shared/containers/ResourceViewActionsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useNexusContext } from '@bbp/react-nexus';
import { Button, Col, Dropdown, Menu, Row, notification } from 'antd';
import { generatePath, Link, useHistory, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { uniq } from 'lodash';
import { isArray, isString, uniq } from 'lodash';
import { makeResourceUri } from '../utils';
import { RootState } from '../store/reducers';
import { useOrganisationsSubappContext } from '../../subapps/admin';
Expand Down Expand Up @@ -123,10 +123,15 @@ const ResourceViewActionsContainer: React.FC<{
);
nexus.Resource.get(orgLabel, projectLabel, encodedResourceId).then(
resource => {
// @ts-ignore
if (resource && resource['@type'].includes('View')) {
// @ts-ignore
setView(resource);
const resourceType = resource ? (resource as Resource)['@type'] : null;
const isView =
resourceType && isArray(resourceType)
? resourceType.includes('View')
: isString(resourceType)
? resourceType === 'View'
: false;
if (isView) {
setView(resource as Resource);
}
}
);
Expand Down
Loading