# BaseSessionModel

Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the [developer guide](https://jbrowse.org/jb2/docs/developer_guide/) for concepts. Built into JBrowse core. [View source](https://github.com/GMOD/jbrowse-components/blob/main/packages/product-core/src/Session/BaseSession.ts).

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 |
| --- | --- |
| **id**<br><code>id: ElementId</code> |  |
| **name**<br><code>name: types.string</code> |  |
| **focusedViewId**<br><code>focusedViewId: types.maybe(types.string)</code> | used to keep track of which view is in focus |
| **highlights**<br><code>highlights: types.stripDefault( types.array(types.frozen&lt;HighlightType&gt;()), [], )</code> | translucent bands over genomic regions; every view draws the ones on its own assemblies |
| **highlightsVisible**<br><code>highlightsVisible: types.stripDefault(types.boolean, true)</code> |  |
| **highlightLabelsVisible**<br><code>highlightLabelsVisible: types.stripDefault(types.boolean, true)</code> | whether a band's label is written on it |
| **heldForMissingPlugins**<br><code>heldForMissingPlugins: types.stripDefault( types.frozen&lt;HeldNode[] &#124; undefined&gt;(), undefined, )</code> | 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. Nothing in the session reads its contents, and `pruneUnbuildableNodes` defines their structure.<br><br>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 |
| --- | --- |
| **selection**<br><code>unknown</code> | 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. |
| **hovered**<br><code>unknown</code> | 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**<br><code>[DialogComponentType, Record&lt;string, unknown&gt;][]</code> |  |
| **preferencesOverrides**<br><code>ObservableMap&lt;string, unknown&gt;</code> | 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.<br><br>An `observable.map` (not a plain object reassigned wholesale) so each preference is its own 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.<br><br>`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:

From [SnackbarModel](../snackbarmodel): [`snackbarMessages`](../snackbarmodel#volatile-snackbarmessages), [`errorDialog`](../snackbarmodel#volatile-errordialog)


## Getters

| Member | Description |
| --- | --- |
| **root**<br><code>TypeOrStateTreeNodeToStateTreeNode&lt;ROOT_MODEL_TYPE&gt;</code> |  |
| **jbrowse**<br><code>any</code> |  |
| **rpcManager**<br><code>RpcManager</code> |  |
| **configuration**<br><code>Instance&lt;JB_CONFIG_SCHEMA&gt;</code> |  |
| **adminMode**<br><code>boolean</code> |  |
| **textSearchManager**<br><code>TextSearchManager</code> |  |
| **assemblies**<br><code>(ConfigNodeProps&lt;…&gt; &amp; ConfigNodeActions &amp; ConfigNodeBrand&lt;ConfigurationSchemaType&lt;…&gt;&gt;)[]</code> |  |
| **DialogComponent**<br><code>DialogComponentType</code> |  |
| **DialogProps**<br><code>Record&lt;string, unknown&gt;</code> |  |
| **animationMode**<br><code>AnimationMode</code> | resolved feature-layout animation mode (never undefined) |
| **scrollZoom**<br><code>boolean</code> | resolved scroll-to-zoom preference. Global and personal (never shared in a session snapshot); every wheel-zoom view reads this single value. |
| **numberGrouping**<br><code>boolean</code> | 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:

From [SnackbarModel](../snackbarmodel): [`snackbarMessageSet`](../snackbarmodel#getter-snackbarmessageset)


## Methods

| Member | Description |
| --- | --- |
| **getPreferenceDefault**<br><code>(key: string) =&gt; unknown</code> | the admin/embedder `configuration.preferences` value for a key, ignoring any runtime override — i.e. what a reset falls back to |
| **getPreference**<br><code>(key: string) =&gt; unknown</code> | 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**<br><code>() =&gt; TrackConfigChange[]</code> | 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**<br><code>(thing: unknown) =&gt; void</code> | set the global selection, i.e. the globally-selected object. can be a feature, a view, just about anything<br><br>A feature is unwrapped on the way in, so app state never holds a 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**<br><code>() =&gt; void</code> | clears the global selection |
| **setHovered**<br><code>(thing: unknown) =&gt; void</code> |  |
| **setHighlightsVisible**<br><code>(arg: boolean) =&gt; void</code> |  |
| **setHighlightLabelsVisible**<br><code>(arg: boolean) =&gt; void</code> |  |
| **addHighlight**<br><code>(highlight: HighlightType) =&gt; void</code> | 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**<br><code>(highlight: HighlightType) =&gt; void</code> |  |
| **updateHighlight**<br><code>(old: HighlightType, updates: Partial&lt;HighlightType&gt;) =&gt; void</code> |  |
| **setHighlights**<br><code>(highlights: HighlightType[]) =&gt; void</code> |  |
| **setPreferenceOverride**<br><code>(key: string, value: unknown) =&gt; void</code> | set a runtime user-preference override (see `getPreference`). Mutates volatile state; products persist these to localStorage. An `undefined` value deletes the key (rather than leaving a phantom entry that `getPreference` reads as absent) so the store never holds dead keys. |
| **clearPreferenceOverrides**<br><code>() =&gt; void</code> | 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**<br><code>(key: string) =&gt; void</code> | 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**<br><code>(flag: boolean) =&gt; void</code> | set the global scroll-to-zoom preference (see the `scrollZoom` getter) |
| **setName**<br><code>(str: string) =&gt; void</code> |  |
| **setFocusedViewId**<br><code>(viewId: string &#124; undefined) =&gt; void</code> | `undefined` is "no view is focused", which the property has always been able to hold (`types.maybe`) and this had no way to spell. Nothing cleared it on teardown as a result: a view that was focused when it left the session left its id behind, and since every consumer compares `focusedViewId === view.id`, the id matched nothing, the focus ring vanished with nothing to say why, and the dead id persisted into a saved or shared session. `takeOut` clears it now. |
| **removeActiveDialog**<br><code>() =&gt; void</code> | Dismiss the dialog on screen as its own 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**<br><code>(doneCallback: DoneCallback) =&gt; void</code> |  |
| **removeDialog**<br><code>(entry: [DialogComponentType, Record&lt;string, unknown&gt;]) =&gt; void</code> |  |

6 inherited actions from one model:

From [SnackbarModel](../snackbarmodel): [`notify`](../snackbarmodel#action-notify), [`notifyError`](../snackbarmodel#action-notifyerror), [`setErrorDialog`](../snackbarmodel#action-seterrordialog), [`pushSnackbarMessage`](../snackbarmodel#action-pushsnackbarmessage), [`popSnackbarMessage`](../snackbarmodel#action-popsnackbarmessage), [`removeSnackbarMessage`](../snackbarmodel#action-removesnackbarmessage)


