Skip to content

Commit

Permalink
Fix opening track selector causing crash in v2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jul 29, 2024
1 parent ac53708 commit 9b57b59
Show file tree
Hide file tree
Showing 7 changed files with 936 additions and 912 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,47 @@ export default function stateTreeFactory(pluginManager: PluginManager) {
faceted: types.optional(facetedStateTreeF(), {}),
})
.volatile(() => ({
/**
* #volatile
*/
favorites: localStorageGetJSON<string[]>(favoritesK(), []),
/**
* #volatile
*/
recentlyUsed: [] as string[],
/**
* #volatile
*/
selection: [] as AnyConfigurationModel[],
/**
* #volatile
*/
sortTrackNames: localStorageGetJSON<MaybeBoolean>(
sortTrackNamesK(),
undefined,
),
/**
* #volatile
*/
sortCategories: localStorageGetJSON<MaybeBoolean>(
sortCategoriesK(),
undefined,
),
/**
* #volatile
*/
collapsed: observable.map<string, boolean>(),
/**
* #volatile
*/
filterText: '',
/**
* #volatile
*/
recentlyUsedCounter: 0,
/**
* #volatile
*/
favoritesCounter: 0,
}))
.views(self => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@ export default function DeletePluginDialog({
>
Confirm
</Button>
<Button
variant="contained"
color="secondary"
onClick={() => {
onClose()
}}
>
<Button variant="contained" color="secondary" onClick={() => onClose()}>
Cancel
</Button>
</DialogActions>
Expand Down
15 changes: 0 additions & 15 deletions plugins/data-management/src/PluginStoreWidget/model.test.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions plugins/data-management/src/PluginStoreWidget/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,35 @@ import { ElementId } from '@jbrowse/core/util/types/mst'
export default function stateModelFactory(pluginManager: PluginManager) {
return types
.model('PluginStoreModel', {
/**
* #property
*/
id: ElementId,
/**
* #property
*/
type: types.literal('PluginStoreWidget'),
/**
* #property
*/
filterText: '',
/**
* #property
*/
view: types.safeReference(
pluginManager.pluggableMstType('view', 'stateModel'),
),
})
.actions(self => ({
/**
* #action
*/
clearFilterText() {
self.filterText = ''
},
/**
* #action
*/
setFilterText(newText: string) {
self.filterText = newText
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ const ReturnToImportFormDialog = lazy(
* - [BaseViewModel](../baseviewmodel)
*/
function stateModelFactory(pluginManager: PluginManager) {
const model = pluginManager.getViewType('LinearGenomeView')
.stateModel as LinearGenomeViewStateModel
return types
.compose(
'LinearComparativeView',
Expand Down Expand Up @@ -81,17 +79,14 @@ function stateModelFactory(pluginManager: PluginManager) {
* currently this is limited to an array of two
*/
views: types.array(
model.views(self => ({
scaleBarDisplayPrefix() {
return self.assemblyNames[0]
},
})),
pluginManager.getViewType('LinearGenomeView')
.stateModel as LinearGenomeViewStateModel,
),

/**
* #property
* this represents tracks specific to this view specifically used
* for read vs ref dotplots where this track would not really apply
* this represents tracks specific to this view specifically used for
* read vs ref dotplots where this track would not really apply
* elsewhere
*/
viewTrackConfigs: types.array(
Expand All @@ -100,6 +95,9 @@ function stateModelFactory(pluginManager: PluginManager) {
}),
)
.volatile(() => ({
/**
* #volatile
*/
width: undefined as number | undefined,
}))
.views(self => ({
Expand Down
16 changes: 11 additions & 5 deletions plugins/linear-genome-view/src/LinearGenomeView/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
resolveIdentifier,
types,
Instance,
getParent,
} from 'mobx-state-tree'

import Base1DView from '@jbrowse/core/util/Base1DViewModel'
Expand Down Expand Up @@ -293,9 +294,6 @@ export function stateModelFactory(pluginManager: PluginManager) {
rightOffset: undefined as undefined | BpOffset,
}))
.views(self => ({
scaleBarDisplayPrefix() {
return ''
},
/**
* #getter
* this is the effective value of the track labels setting, incorporating
Expand Down Expand Up @@ -336,6 +334,15 @@ export function stateModelFactory(pluginManager: PluginManager) {
},
}))
.views(self => ({
/**
* #method
*/
scaleBarDisplayPrefix() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return getParent<any>(self, 2).type === 'LinearSyntenyView'
? self.assemblyNames[0]
: ''
},
/**
* #method
*/
Expand All @@ -357,8 +364,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
*/
get assemblyErrors() {
const { assemblyManager } = getSession(self)
const { assemblyNames } = self
return assemblyNames
return self.assemblyNames
.map(a => assemblyManager.get(a)?.error)
.filter(f => !!f)
.join(', ')
Expand Down
Loading

0 comments on commit 9b57b59

Please sign in to comment.