Skip to content

Commit

Permalink
Fix "Add track" select box not going away after selecting element (#4633
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cmdcolin authored Nov 3, 2024
1 parent 1746188 commit be177a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React, { Suspense, useState } from 'react'
import { observer } from 'mobx-react'
import { FormControl, FormHelperText, Select, MenuItem } from '@mui/material'
import { getEnv } from '@jbrowse/core/util'
Expand All @@ -14,12 +14,14 @@ const AddTrackSelector = observer(function ({
model: AddTrackModel
}) {
const [val, setVal] = useState('Default add track workflow')
const { pluginManager } = getEnv(model)
const widgets = pluginManager.getAddTrackWorkflowElements()
const ComponentMap = {
'Default add track workflow': DefaultAddTrackWorkflow,
'Add track JSON': PasteConfigWorkflow,
...Object.fromEntries(widgets.map(w => [w.name, w.ReactComponent])),
...Object.fromEntries(
getEnv(model)
.pluginManager.getAddTrackWorkflowElements()
.map(w => [w.name, w.ReactComponent]),
),
} as Record<string, React.FC<{ model: AddTrackModel }>>

// make sure the selected value is in the list
Expand All @@ -43,8 +45,9 @@ const AddTrackSelector = observer(function ({
<FormHelperText>Type of add track workflow</FormHelperText>
</FormControl>

<br />
<Component model={model} />
<Suspense fallback={null}>
<Component model={model} />
</Suspense>
</>
)
})
Expand Down
2 changes: 1 addition & 1 deletion products/jbrowse-cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Create extends JBrowseCommand {
description:
'Overwrites existing JBrowse 2 installation if present in path',
}),
// will need to account for pagenation once there is a lot of releases
// will need to account for pagination once there is a lot of releases
listVersions: Flags.boolean({
char: 'l',
description: 'Lists out all versions of JBrowse 2',
Expand Down
2 changes: 1 addition & 1 deletion products/jbrowse-cli/src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class Upgrade extends JBrowseCommand {

static flags = {
help: Flags.help({ char: 'h' }),
// will need to account for pagenation once there is a lot of releases
// will need to account for pagination once there is a lot of releases
listVersions: Flags.boolean({
char: 'l',
description: 'Lists out all versions of JBrowse 2',
Expand Down

0 comments on commit be177a4

Please sign in to comment.