Unverified Commit e341f858 authored by Jyothish's avatar Jyothish Committed by GitHub
Browse files

Update Product type and fix External references tab (#581)

parent 8f02955f
Pipeline #193125 passed with stages
in 4 minutes and 32 seconds
......@@ -148,7 +148,7 @@ describe('<TranscriptsListItemInfo /', () => {
it('calls correct callback when protein link is clicked', () => {
const { container } = renderComponent();
const proteinId =
defaultProps.transcript.product_generating_contexts[0].product.stable_id;
defaultProps.transcript.product_generating_contexts[0].product?.stable_id;
const proteinLink = [...container.querySelectorAll('a')].find(
(link) => link.textContent === proteinId
) as HTMLElement;
......
......@@ -67,11 +67,7 @@ type Transcript = Pick<
} & {
product_generating_contexts: Array<
Pick<FullProductGeneratingContext, 'product_type'> &
Pick2<
FullProductGeneratingContext,
'product',
'length' | 'stable_id'
> & {
Pick<FullProductGeneratingContext, 'product'> & {
phased_exons: Array<
Pick<PhasedExon, 'start_phase' | 'end_phase'> &
Pick2<PhasedExon, 'exon', 'stable_id'>
......@@ -192,6 +188,7 @@ export const TranscriptsListItemInfo = (
);
};
const product = transcript.product_generating_contexts[0].product;
return (
<div className={mainStyles}>
<div className={transcriptsListStyles.left}></div>
......@@ -208,9 +205,7 @@ export const TranscriptsListItemInfo = (
<div>
<strong>{aminoAcidLength} aa</strong>
</div>
{getLinkToProteinView(
transcript.product_generating_contexts[0]?.product.stable_id
)}
{product && getLinkToProteinView(product?.stable_id)}
</>
)}
</div>
......
......@@ -108,7 +108,7 @@ type Transcript = {
slice: Pick2<Slice, 'location', 'length'>;
product_generating_contexts: Array<
Pick<FullProductGeneratingContext, 'product_type'> & {
product: { external_references: ExternalReferenceType[] };
product: { external_references: ExternalReferenceType[] } | null;
}
>;
external_references: ExternalReferenceType[];
......@@ -223,9 +223,10 @@ const TranscriptXrefs = (props: { transcript: Transcript }) => {
// Add protein level xrefs
transcript.product_generating_contexts.forEach(
(product_generating_context) => {
unsortedXrefs.push(
...product_generating_context.product.external_references
);
product_generating_context.product &&
unsortedXrefs.push(
...product_generating_context.product.external_references
);
}
);
......
......@@ -119,7 +119,7 @@ export type GetProductAminoAcidLengthParam = {
product_type: ProductType.PROTEIN;
product: {
length: number;
};
} | null;
}>;
};
......
......@@ -28,7 +28,7 @@ export type FullProductGeneratingContext = {
cds: FullCDS | null;
five_prime_utr: UTR | null;
three_prime_utr: UTR | null;
product: Product;
product: Product | null;
phased_exons: PhasedExon[];
cdna: CDNA;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment