Skip to content

Commit

Permalink
Lazy load protein panel
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 6, 2024
1 parent 1ac67d1 commit 172e016
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { Suspense, lazy } from 'react'
import { observer } from 'mobx-react'
import { onSnapshot } from 'mobx-state-tree'
import { MSAView } from 'react-msaview'
Expand All @@ -7,7 +7,9 @@ import { ThemeProvider } from '@mui/material/styles'

// locals
import AppGlobal, { AppModel } from './model'
import ProteinPanel from './ProteinPanel'

// lazies
const ProteinPanel = lazy(() => import('./ProteinPanel'))

const urlParams = new URLSearchParams(window.location.search)
const val = urlParams.get('data')
Expand Down Expand Up @@ -41,7 +43,11 @@ const App = observer(({ model }: { model: AppModel }) => {
<div style={{ border: '1px solid black', margin: 20 }}>
<MSAView model={msaview} />
</div>
<ProteinPanel model={model} />
{msaview.selectedStructures.length ? (
<Suspense fallback={null}>
<ProteinPanel model={model} />
</Suspense>
) : null}
</div>
)
})
Expand Down

0 comments on commit 172e016

Please sign in to comment.