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

bugfix/DEVSU-2482 gene viewer not working therapeutic targets #576

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const mockReport = {
const withReportContext = (Component) => function ReportContextHOC(props) {
return (
// eslint-disable-next-line react/jsx-no-constructed-context-values
<ReportContext.Provider value={{ report: mockReport, setReport: () => {} }}>
<ReportContext.Provider value={{ report: mockReport, setReport: () => {}, canEdit: true }}>
<Component {...props} />
</ReportContext.Provider>
);
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('GeneViewer', () => {
expect(screen.getByRole('dialog')).toBeInTheDocument();
});

test('It closes the dialog if gene does not exist', async () => {
test('Dialog still opens if gene does not exist', async () => {
when(api.get as (endpoint: string) => Partial<ApiCall>)
.calledWith(`/reports/${mockReport.ident}/gene-viewer/${mockErrorGene}`)
.mockImplementation(() => ({ request: async () => { throw new Error(); } }));
Expand All @@ -112,7 +112,7 @@ describe('GeneViewer', () => {
const dialog = screen.getByRole('dialog');
expect(dialog).toBeInTheDocument();
await waitFor(() => {
expect(dialog).not.toBeInTheDocument();
expect(dialog).toBeInTheDocument();
});
});

Expand Down
14 changes: 11 additions & 3 deletions app/components/DataTable/components/GeneViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { AgGridReact } from '@ag-grid-community/react';

import api from '@/services/api';
import snackbar from '@/services/SnackbarUtils';
import ReportContext from '@/context/ReportContext';
import { columnDefs } from '@/views/ReportView/components/KbMatches/columnDefs';
import { columnDefs as smallMutationsColumnDefs } from '@/views/ReportView/components/SmallMutations/columnDefs';
Expand All @@ -40,6 +39,15 @@ const defaultTableOptions = {
enableCellTextSelection: true,
};

const nullGeneViewerResp: GeneViewerType = {
copyNumber: [],
expDensityGraph: [],
expRNA: [],
kbMatchedStatements: [],
smallMutations: [],
structuralVariants: [],
};

type GeneViewerProps = {
isLink: boolean;
gene: string;
Expand All @@ -66,8 +74,8 @@ const GeneViewer = ({
const resp = await api.get(`/reports/${report.ident}/gene-viewer/${gene}`).request();
setGeneData(resp);
} catch {
snackbar.error(`Error: gene viewer data does not exist for ${gene}`);
setIsOpen(false);
// DEVSU-2482 Show table with no rows to show instead of snackbar error for genes that do not exist in report's profile
setGeneData(nullGeneViewerResp);
}
};
getData();
Expand Down