Skip to content

Commit

Permalink
Merge pull request #20 from opentargets/lf-subcell-fix
Browse files Browse the repository at this point in the history
Fix subcellular location triggering re-rendering of target page
  • Loading branch information
LucaFumis authored Jul 4, 2022
2 parents 12fed92 + fbdda1c commit c9db43c
Showing 1 changed file with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { lazy, useEffect, useRef } from 'react';
import React, { lazy, useEffect, useRef, Suspense } from 'react';
import {
Typography,
List,
Expand All @@ -13,8 +13,11 @@ import { faMapMarkerAlt } from '@fortawesome/free-solid-svg-icons';

import Link from '../../../components/Link';
import { identifiersOrgLink, getUniprotIds } from '../../../utils/global';
import LoadingBackdrop from '../../../components/LoadingBackdrop';

const SwissbioViz = lazy(() => import('./SwissbioViz'));
const SwissbioViz = 'customElements' in window
? lazy(() => import('./SwissbioViz'))
: ({ children }) => <>{children}</>;

const useStyles = makeStyles(theme => ({
locationIcon: {
Expand Down Expand Up @@ -171,23 +174,25 @@ function SubcellularViz({ data: target }) {
key={i}
className={classes.tabPanel}
>
<SwissbioViz
taxonId="9606"
locationIds={sourcesLocations[s.id]
.map(l => parseLocationTerm(l.termSL))
.join()}
sourceId={s.id.toLowerCase()}
>
<Box ml={4} key={s.id}>
<Typography variant="h6">{s.label}</Typography>
Location for{' '}
<LocationLink
sourceId={s.id}
id={s.id === 'uniprot' ? uniprotId : target.id}
/>
<LocationsList sls={sourcesLocations[s.id]} />
</Box>
</SwissbioViz>
<Suspense fallback={<LoadingBackdrop />}>
<SwissbioViz
taxonId="9606"
locationIds={sourcesLocations[s.id]
.map(l => parseLocationTerm(l.termSL))
.join()}
sourceId={s.id.toLowerCase()}
>
<Box ml={4} key={s.id}>
<Typography variant="h6">{s.label}</Typography>
Location for{' '}
<LocationLink
sourceId={s.id}
id={s.id === 'uniprot' ? uniprotId : target.id}
/>
<LocationsList sls={sourcesLocations[s.id]} />
</Box>
</SwissbioViz>
</Suspense>
</div>
))}
</SubcellularVizTabs>
Expand Down

0 comments on commit c9db43c

Please sign in to comment.