Skip to content

Commit

Permalink
Navigate without setting displayedRegion first
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Mar 19, 2021
1 parent e2594e3 commit dfc2438
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions products/jbrowse-react-linear-genome-view/src/createViewState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PluginConstructor } from '@jbrowse/core/Plugin'
import { autorun } from 'mobx'
import { SnapshotIn, onPatch, IJsonPatch, getSnapshot } from 'mobx-state-tree'
import { SnapshotIn, onPatch, IJsonPatch } from 'mobx-state-tree'
import createModel, {
createSessionModel,
createConfigModel,
Expand Down Expand Up @@ -64,16 +64,9 @@ export default function createViewState(opts: ViewStateOptions) {
stateTree.assemblyManager.allPossibleRefNames.length
) {
if (stateTree.session.view.initialized) {
if (!stateTree.session.view.displayedRegions.length) {
const assemblyState = stateTree.assemblyManager.assemblies[0]
const region =
assemblyState && assemblyState.regions && assemblyState.regions[0]
if (region) {
stateTree.session.view.setDisplayedRegions([getSnapshot(region)])
}
}
if (typeof location === 'string') {
stateTree.session.view.navToLocString(location)
const assemblyName = stateTree.assemblyManager.assemblies[0].name
stateTree.session.view.navToLocString(location, assemblyName)
} else {
stateTree.session.view.navTo(location)
}
Expand Down

0 comments on commit dfc2438

Please sign in to comment.