BaseSessionModel
Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the developer guide for concepts. Built into JBrowse core. View source.
Holds a session's name, focused view, highlights and notifications. Every product's session composes this model, so add to it with care.
Each section ends with the members a composed model contributes, linked to the page that documents them.
Properties
| Member | Description |
|---|---|
idid: ElementId | |
namename: types.string | |
focusedViewIdfocusedViewId: types.maybe(types.string) | id of the view in focus |
| highlights | translucent bands over genomic regions; every view draws the ones on the assemblies it shows |
highlightsVisiblehighlightsVisible: types.stripDefault(types.boolean, true) | |
highlightLabelsVisiblehighlightLabelsVisible: types.stripDefault(types.boolean, true) | whether a band's label is written on it |
| heldForMissingPlugins | views, tracks, displays and widgets pruneUnbuildableNodes took out of the tree because this build has no plugin for their type, each with the anchor that puts it back. No session code reads its contents, and pruneUnbuildableNodes defines their structure.It is a declared property because MST drops undeclared snapshot keys without error. Without this declaration the held nodes survive the prune and are then discarded when setSession builds the tree, while every unit test of the prune still passes. heldNodesSurviveTheSession.test.ts tests that they survive. |
Volatiles
| Member | Description |
|---|---|
selectionunknown | this is the globally "selected" object. can be anything. code that wants to deal with this should examine it to see what kind of thing it is. |
hoveredunknown | this is the globally "hovered" object. can be anything. code that wants to deal with this should examine it to see what kind of thing it is. |
queueOfDialogs[DialogComponentType, Record<string, unknown>][] | |
preferencesOverridesObservableMap<string, unknown> | runtime user-preference overrides keyed by preference id, resolved by getPreference against the configuration.preferences admin defaults. Empty here (config-only); products that let users edit preferences load and persist these via localStorage. A runtime override map layered over config defaults, kept off the snapshot since prefs are local UI.An observable.map (not a plain object reassigned wholesale) so each preference is a separate tracked key: writing one (setScrollZoom) can't invalidate a reader of another. A single spread-replaced object made every setter wake every reader, so toggling scroll-to-zoom re-fetched every track.deep: false keeps an object-valued preference a plain object rather than a MobX Proxy, which V8's structured-clone serializer rejects. The map still notifies per key on set, so shallow values lose no reactivity — and nothing can mutate a preference in place, because setPreferenceOverride freezes what it stores. |
2 inherited volatiles from one model
Getters
| Member | Description |
|---|---|
rootTypeOrStateTreeNodeToStateTreeNode<ROOT_MODEL_TYPE> | |
jbrowseany | |
rpcManagerRpcManager | |
configurationInstance<JB_CONFIG_SCHEMA> | |
adminModeboolean | |
textSearchManagerTextSearchManager | |
assembliesBaseAssemblyConfig[] | |
DialogComponentDialogComponentType | |
DialogPropsRecord<string, unknown> | |
animationModeAnimationMode | resolved feature-layout animation mode (never undefined) |
scrollZoomboolean | resolved scroll-to-zoom preference. Global and personal (never shared in a session snapshot); every wheel-zoom view reads this single value. |
numberGroupingboolean | resolved thousand-separator preference. Read for display in the Preferences dialog; the formatter itself reads a plain module variable set at startup in each realm (see setNumberGrouping), because worker- built strings can't see a main-thread observable. |
1 inherited getter from one model
Methods
| Member | Description |
|---|---|
getPreferenceDefault(key: string) => unknown | the admin/embedder configuration.preferences value for a key, ignoring any runtime override — i.e. what a reset falls back to |
getPreference(key: string) => unknown | resolved value of a user preference: a runtime override if the user set one, otherwise the admin/embedder configuration.preferences default. The override map is empty unless the product loads it (web/desktop). |
getPreferenceChanges() => TrackConfigChange[] | every scalar preference override that currently differs from its config/admin default, as { path, from, to } rows whose path is the override's own key. A scalar pref (animationMode, scrollZoom) whose override equals the default is omitted, since reverting it is a no-op. |
Actions
| Member | Description |
|---|---|
setSelection(thing: unknown) => void | set the global selection, i.e. the globally-selected object. can be a feature, a view, or any other object A feature is unwrapped on the way in, so app state holds no jexlFeatureProxy. isFeature accepts a proxy, but on one id is a data field rather than the method the Feature type promises — every consumer doing isFeature(selection) ? selection.id() : … would throw. |
clearSelection() => void | clears the global selection |
setHovered(thing: unknown) => void | |
setHighlightsVisible(arg: boolean) => void | |
setHighlightLabelsVisible(arg: boolean) => void | |
addHighlight(highlight: HighlightType) => void | an identical entry is not added twice, so a spec launched again does not stack its bands. Adding shows the bands again, since a highlight made while they are off would otherwise read as nothing happening |
removeHighlight(highlight: HighlightType) => void | |
updateHighlight(old: HighlightType, updates: Partial<HighlightType>) => void | |
setHighlights(highlights: HighlightType[]) => void | |
setPreferenceOverride(key: string, value: unknown) => void | set a runtime user-preference override (see getPreference). Mutates volatile state; products persist these to localStorage. An undefined value deletes the key, so the store holds no dead keys that getPreference would read as absent. |
clearPreferenceOverrides() => void | clear every runtime preference override at once, so each falls back to its config/admin default. Backs the Preferences dialog "Reset to defaults" button. |
clearPreferenceOverride(key: string) => void | clear a single runtime preference override (see getPreference) so it falls back to its config/admin default. Backs the per-entry reset in the Preferences dialog "Reset to defaults" confirmation. |
setScrollZoom(flag: boolean) => void | set the global scroll-to-zoom preference (see the scrollZoom getter) |
setName(str: string) => void | |
setFocusedViewId(viewId: string | undefined) => void | undefined is "no view is focused", which the property can hold (types.maybe). takeOut sets it when the focused view leaves the session. Otherwise the dead id would match no view, since every consumer compares focusedViewId === view.id, the focus ring would vanish, and the id would persist into a saved or shared session. |
removeActiveDialog() => void | Dismiss the dialog on screen as the dialog's close button would, so a dialog that settles a promise on close (an internet account's token prompt) settles it, and drop it from the queue if it did not. |
| queueDialog | |
removeDialog(entry: [DialogComponentType, Record<string, unknown>]) => void |
6 inherited actions from one model
From SnackbarModel: notify, notifyError, setErrorDialog, pushSnackbarMessage, popSnackbarMessage, removeSnackbarMessage
Related links
- User guide: Highlights