Skip to content

Commit

Permalink
More fixes to not use getSnapshot for assembly regions
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 21, 2021
1 parent f3deaba commit e20b7fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
10 changes: 9 additions & 1 deletion packages/core/assemblyManager/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ export default function assemblyFactory(
return types
.model({
configuration: types.safeReference(assemblyConfigType),
regions: types.frozen(),
regions: types.frozen<
| {
start: number
end: number
refName: string
assemblyName: string
}[]
| undefined
>(),
refNameAliases: types.maybe(types.map(types.string)),
})
.views(self => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fade } from '@material-ui/core/styles/colorManipulator'
import FormGroup from '@material-ui/core/FormGroup'
import Typography from '@material-ui/core/Typography'
import { observer } from 'mobx-react'
import { Instance, getEnv, getSnapshot } from 'mobx-state-tree'
import { Instance, getEnv } from 'mobx-state-tree'
import React from 'react'

import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons'
Expand Down Expand Up @@ -129,7 +129,7 @@ const LinearGenomeViewHeader = observer(({ model }: { model: LGV }) => {
region => newRegionValue === region.refName,
)
if (newRegion) {
model.setDisplayedRegions([getSnapshot(newRegion)])
model.setDisplayedRegions([newRegion])
// we use showAllRegions after setDisplayedRegions to make the entire
// region visible, xref #1703
model.showAllRegions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function SearchResultsDialog({
region => location === region.refName,
)
if (newRegion) {
model.setDisplayedRegions([getSnapshot(newRegion)])
model.setDisplayedRegions([newRegion])
// we use showAllRegions after setDisplayedRegions to make the entire
// region visible, xref #1703
model.showAllRegions()
Expand Down
2 changes: 1 addition & 1 deletion plugins/linear-genome-view/src/LinearGenomeView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ export function stateModelFactory(pluginManager: PluginManager) {
region => region.refName === canonicalRefName,
)
if (newDisplayedRegion) {
this.setDisplayedRegions([getSnapshot(newDisplayedRegion)])
this.setDisplayedRegions([newDisplayedRegion])
} else {
throw new Error(
`Could not find refName ${parsedLocString.refName} in ${assembly.name}`,
Expand Down

0 comments on commit e20b7fe

Please sign in to comment.