Skip to content

Commit 3558cfe

Browse files
committed
Re-enables
1 parent dffad30 commit 3558cfe

18 files changed

Lines changed: 102 additions & 214 deletions

config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,6 @@
117117
}
118118
]
119119
}
120-
]
120+
],
121+
"aggregateTextSearchAdapters": []
121122
}

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default defineConfig(
1515
'esbuild-watch.mjs',
1616
'eslint.config.mjs',
1717
'ucsc/*',
18+
'.test*',
1819
'.test-jbrowse/*',
1920
],
2021
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"g2p_mapper": "^2.0.0",
3434
"idb": "^8.0.3",
3535
"pako-esm2": "^2.0.0",
36-
"react-msaview": "^5.0.4",
36+
"react-msaview": "^5.0.5",
3737
"swr": "^2.3.8"
3838
},
3939
"devDependencies": {

src/AddHighlightModel/GenomeMouseoverHighlight.tsx

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef } from 'react'
1+
import React from 'react'
22

33
import { getSession } from '@jbrowse/core/util'
44
import { observer } from 'mobx-react'
@@ -12,22 +12,6 @@ const GenomeMouseoverHighlight = observer(function ({
1212
}: {
1313
model: LinearGenomeViewModel
1414
}) {
15-
const renderCount = useRef(0)
16-
const lastRender = useRef(performance.now())
17-
18-
renderCount.current++
19-
const now = performance.now()
20-
const delta = now - lastRender.current
21-
lastRender.current = now
22-
23-
if (delta < 50) {
24-
console.log(
25-
'[MSA-DEBUG] GenomeMouseoverHighlight outer render',
26-
`#${renderCount.current}`,
27-
`delta=${delta.toFixed(1)}ms`,
28-
)
29-
}
30-
3115
const session = getSession(model)
3216
const { hovered, views } = session
3317

@@ -54,34 +38,16 @@ const GenomeMouseoverHighlightRenderer = observer(function ({
5438
hovered,
5539
}: {
5640
model: LinearGenomeViewModel
57-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
41+
5842
hovered: any
5943
}) {
60-
const renderCount = useRef(0)
61-
const lastRender = useRef(performance.now())
62-
63-
renderCount.current++
64-
const now = performance.now()
65-
const delta = now - lastRender.current
66-
lastRender.current = now
67-
6844
const { classes } = useStyles()
6945
const { offsetPx } = model
7046
const { coord, refName } = hovered.hoverPosition as {
7147
coord: number
7248
refName: string
7349
}
7450

75-
if (delta < 50) {
76-
console.log(
77-
'[MSA-DEBUG] GenomeMouseoverHighlightRenderer render',
78-
`#${renderCount.current}`,
79-
`delta=${delta.toFixed(1)}ms`,
80-
`offsetPx=${offsetPx}`,
81-
`coord=${coord}`,
82-
)
83-
}
84-
8551
const s = model.bpToPx({ refName, coord: coord - 1 })
8652
const e = model.bpToPx({ refName, coord: coord })
8753

src/AddHighlightModel/HighlightComponents.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef } from 'react'
1+
import React from 'react'
22

33
import { observer } from 'mobx-react'
44

@@ -14,29 +14,10 @@ const HighlightComponents = observer(function HighlightComponents2({
1414
}: {
1515
model: LGV
1616
}) {
17-
const renderCount = useRef(0)
18-
const lastRender = useRef(performance.now())
19-
20-
renderCount.current++
21-
const now = performance.now()
22-
const delta = now - lastRender.current
23-
lastRender.current = now
24-
25-
// Log if rendering more frequently than 50ms
26-
if (delta < 50) {
27-
console.log(
28-
'[MSA-DEBUG] HighlightComponents render',
29-
`#${renderCount.current}`,
30-
`delta=${delta.toFixed(1)}ms`,
31-
`offsetPx=${model.offsetPx}`,
32-
)
33-
}
34-
35-
// TEMPORARILY DISABLED GenomeMouseoverHighlight to test scroll performance
3617
return (
3718
<>
3819
<MsaToGenomeHighlight model={model} />
39-
{/* <GenomeMouseoverHighlight model={model} /> */}
20+
<GenomeMouseoverHighlight model={model} />
4021
</>
4122
)
4223
})

src/AddHighlightModel/MsaToGenomeHighlight.tsx

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef } from 'react'
1+
import React from 'react'
22

33
import { getSession } from '@jbrowse/core/util'
44
import { observer } from 'mobx-react'
@@ -16,22 +16,6 @@ const MsaToGenomeHighlight = observer(function MsaToGenomeHighlight2({
1616
}: {
1717
model: LGV
1818
}) {
19-
const renderCount = useRef(0)
20-
const lastRender = useRef(performance.now())
21-
22-
renderCount.current++
23-
const now = performance.now()
24-
const delta = now - lastRender.current
25-
lastRender.current = now
26-
27-
if (delta < 50) {
28-
console.log(
29-
'[MSA-DEBUG] MsaToGenomeHighlight outer render',
30-
`#${renderCount.current}`,
31-
`delta=${delta.toFixed(1)}ms`,
32-
)
33-
}
34-
3519
const { views } = getSession(model)
3620
const msaView = views.find(f => f.type === 'MsaView') as
3721
| JBrowsePluginMsaViewModel
@@ -55,29 +39,11 @@ const MsaToGenomeHighlightRenderer = observer(function ({
5539
model: LGV
5640
highlights: { refName: string; start: number; end: number }[]
5741
}) {
58-
const renderCount = useRef(0)
59-
const lastRender = useRef(performance.now())
60-
61-
renderCount.current++
62-
const now = performance.now()
63-
const delta = now - lastRender.current
64-
lastRender.current = now
65-
6642
const { classes } = useStyles()
6743
const { assemblyManager } = getSession(model)
6844
const assembly = assemblyManager.get(model.assemblyNames[0]!)
6945
const { offsetPx } = model
7046

71-
if (delta < 50) {
72-
console.log(
73-
'[MSA-DEBUG] MsaToGenomeHighlightRenderer render',
74-
`#${renderCount.current}`,
75-
`delta=${delta.toFixed(1)}ms`,
76-
`offsetPx=${offsetPx}`,
77-
`highlights=${highlights.length}`,
78-
)
79-
}
80-
8147
if (!assembly) {
8248
return null
8349
}

src/AddHighlightModel/index.tsx

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,20 @@ import HighlightComponents from './HighlightComponents'
77

88
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
99

10-
let lastExtensionPointCall = 0
11-
1210
export default function AddHighlightComponentsModelF(
13-
_pluginManager: PluginManager,
11+
pluginManager: PluginManager,
1412
) {
15-
// TEMPORARILY DISABLED - testing scroll performance
16-
// The extension point callback itself seems to cause stepwise scrolling
17-
console.log('[MSA-DEBUG] Extension point registration DISABLED for testing')
18-
return
19-
20-
/*
2113
pluginManager.addToExtensionPoint(
2214
'LinearGenomeView-TracksContainerComponent',
2315
// @ts-expect-error
2416
(rest: React.ReactNode[], { model }: { model: LinearGenomeViewModel }) => {
25-
const now = performance.now()
26-
const delta = now - lastExtensionPointCall
27-
lastExtensionPointCall = now
28-
29-
// Log if called more frequently than 100ms
30-
if (delta < 100) {
31-
console.log(
32-
'[MSA-DEBUG] ExtensionPoint callback called rapidly',
33-
`delta=${delta.toFixed(1)}ms`,
34-
`offsetPx=${model.offsetPx}`,
35-
)
36-
}
37-
3817
// Quick check: don't add any components if no MSA view exists
3918
const { views } = getSession(model)
4019
const hasMsaView = views.some(v => v.type === 'MsaView')
4120
if (!hasMsaView) {
4221
return rest
4322
}
4423

45-
console.log('[MSA-DEBUG] Adding HighlightComponents, hasMsaView=true')
46-
4724
return [
4825
...rest,
4926
<HighlightComponents
@@ -53,5 +30,4 @@ export default function AddHighlightComponentsModelF(
5330
]
5431
},
5532
)
56-
*/
5733
}

src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import {
2020
getAllCachedResults,
2121
} from '../../../utils/blastCache'
2222

23+
import type { CachedBlastResult } from '../../../utils/blastCache'
2324
import type { AbstractTrackModel } from '@jbrowse/core/util'
2425
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
25-
import type { CachedBlastResult } from '../../../utils/blastCache'
2626

2727
const CachedBlastResults = observer(function ({
2828
model,
@@ -39,16 +39,16 @@ const CachedBlastResults = observer(function ({
3939

4040
const geneId = feature.get('id')
4141
useEffect(() => {
42-
let cancelled = false
43-
getAllCachedResults().then(cached => {
44-
if (!cancelled) {
42+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
43+
;(async () => {
44+
try {
45+
const cached = await getAllCachedResults()
4546
setResults(cached.filter(r => r.geneId === geneId))
4647
setLoading(false)
48+
} catch (e) {
49+
console.error(e)
4750
}
48-
})
49-
return () => {
50-
cancelled = true
51-
}
51+
})()
5252
}, [geneId])
5353

5454
const handleDelete = async (id: string) => {
@@ -85,11 +85,25 @@ const CachedBlastResults = observer(function ({
8585

8686
return (
8787
<div>
88-
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 }}>
88+
<div
89+
style={{
90+
display: 'flex',
91+
justifyContent: 'space-between',
92+
alignItems: 'center',
93+
marginBottom: 8,
94+
}}
95+
>
8996
<Typography variant="subtitle1">
9097
Cached BLAST Results ({results.length})
9198
</Typography>
92-
<Button size="small" color="error" onClick={handleClearAll}>
99+
<Button
100+
size="small"
101+
color="error"
102+
onClick={() => {
103+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
104+
handleClearAll()
105+
}}
106+
>
93107
Clear All
94108
</Button>
95109
</div>
@@ -104,6 +118,7 @@ const CachedBlastResults = observer(function ({
104118
size="small"
105119
onClick={e => {
106120
e.stopPropagation()
121+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
107122
handleDelete(result.id)
108123
}}
109124
>

src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import {
2020
import { observer } from 'mobx-react'
2121
import { makeStyles } from 'tss-react/mui'
2222

23-
import { blastLaunchView } from './blastLaunchView'
2423
import CachedBlastResults from './CachedBlastResults'
25-
import { getAllCachedResults } from '../../../utils/blastCache'
24+
import { blastLaunchView } from './blastLaunchView'
2625
import TextField2 from '../../../components/TextField2'
26+
import { getAllCachedResults } from '../../../utils/blastCache'
2727
import { getGeneDisplayName, getTranscriptDisplayName } from '../../util'
2828
import TranscriptSelector from '../TranscriptSelector'
2929
import { useTranscriptSelection } from '../useTranscriptSelection'
@@ -70,12 +70,20 @@ const NCBIBlastAutomaticPanel = observer(function ({
7070
const [selectedBlastProgram, setSelectedBlastProgram] =
7171
useState<blastProgramsT>('quick-blastp')
7272
const [hasCachedResults, setHasCachedResults] = useState(false)
73+
const [error, setError] = useState<unknown>()
7374

7475
const geneId = feature.get('id')
7576
useEffect(() => {
76-
getAllCachedResults().then(results => {
77-
setHasCachedResults(results.some(r => r.geneId === geneId))
78-
})
77+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
78+
;(async () => {
79+
try {
80+
const results = await getAllCachedResults()
81+
setHasCachedResults(results.some(r => r.geneId === geneId))
82+
} catch (e) {
83+
console.error(e)
84+
setError(e)
85+
}
86+
})()
7987
}, [geneId])
8088

8189
const {
@@ -91,7 +99,7 @@ const NCBIBlastAutomaticPanel = observer(function ({
9199
setSelectedBlastProgram('blastp')
92100
}
93101
}, [selectedBlastDatabase])
94-
const e = proteinSequenceError ?? launchViewError
102+
const e = proteinSequenceError ?? launchViewError ?? error
95103
const style = { width: 150 }
96104
return (
97105
<>
@@ -194,7 +202,11 @@ const NCBIBlastAutomaticPanel = observer(function ({
194202
<Typography>Previous BLAST Results</Typography>
195203
</AccordionSummary>
196204
<AccordionDetails>
197-
<CachedBlastResults model={model} handleClose={handleClose} feature={feature} />
205+
<CachedBlastResults
206+
model={model}
207+
handleClose={handleClose}
208+
feature={feature}
209+
/>
198210
</AccordionDetails>
199211
</Accordion>
200212
) : null}

src/LaunchMsaView/components/NCBIBlastQuery/blastLaunchView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Feature, getSession } from '@jbrowse/core/util'
22

3-
import type { CachedBlastResult } from '../../../utils/blastCache'
43
import type { JBrowsePluginMsaViewModel } from '../../../MsaViewPanel/model'
4+
import type { CachedBlastResult } from '../../../utils/blastCache'
55
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
66

77
export function blastLaunchView({

0 commit comments

Comments
 (0)