# MultipleViewsSessionMixin

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/MultipleViews.ts).

Adds a list of views to a session, with actions to add, remove, replace and
reorder them.

Each section ends with the members a composed model contributes, linked to the page that documents them.

## Properties

| Member | Description |
| --- | --- |
| **views**<br><code>views: types.array( pluginManager.pluggableMstType('view', 'stateModel'), )</code> |  |
| **stickyViewHeaders**<br><code>stickyViewHeaders: types.optional(types.boolean, () =&gt; localStorageGetBoolean('stickyViewHeaders', true), )</code> |  |

12 inherited properties from 2 models:

From [BaseSessionModel](../basesessionmodel): [`id`](../basesessionmodel#property-id), [`name`](../basesessionmodel#property-name), [`focusedViewId`](../basesessionmodel#property-focusedviewid), [`highlights`](../basesessionmodel#property-highlights), [`highlightsVisible`](../basesessionmodel#property-highlightsvisible), [`highlightLabelsVisible`](../basesessionmodel#property-highlightlabelsvisible), [`heldForMissingPlugins`](../basesessionmodel#property-heldformissingplugins)

From [DrawerWidgetSessionMixin](../drawerwidgetsessionmixin): [`drawerPosition`](../drawerwidgetsessionmixin#property-drawerposition), [`drawerWidth`](../drawerwidgetsessionmixin#property-drawerwidth), [`widgets`](../drawerwidgetsessionmixin#property-widgets), [`activeWidgets`](../drawerwidgetsessionmixin#property-activewidgets), [`minimized`](../drawerwidgetsessionmixin#property-minimized)


## Volatiles

8 inherited volatiles from 3 models:

From [BaseSessionModel](../basesessionmodel): [`selection`](../basesessionmodel#volatile-selection), [`hovered`](../basesessionmodel#volatile-hovered), [`queueOfDialogs`](../basesessionmodel#volatile-queueofdialogs), [`preferencesOverrides`](../basesessionmodel#volatile-preferencesoverrides)

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

From [DrawerWidgetSessionMixin](../drawerwidgetsessionmixin): [`poppedOut`](../drawerwidgetsessionmixin#volatile-poppedout), [`modalWidgets`](../drawerwidgetsessionmixin#volatile-modalwidgets)


## Getters

16 inherited getters from 3 models:

From [BaseSessionModel](../basesessionmodel): [`root`](../basesessionmodel#getter-root), [`jbrowse`](../basesessionmodel#getter-jbrowse), [`rpcManager`](../basesessionmodel#getter-rpcmanager), [`configuration`](../basesessionmodel#getter-configuration), [`adminMode`](../basesessionmodel#getter-adminmode), [`textSearchManager`](../basesessionmodel#getter-textsearchmanager), [`assemblies`](../basesessionmodel#getter-assemblies), [`DialogComponent`](../basesessionmodel#getter-dialogcomponent), [`DialogProps`](../basesessionmodel#getter-dialogprops), [`animationMode`](../basesessionmodel#getter-animationmode), [`scrollZoom`](../basesessionmodel#getter-scrollzoom), [`numberGrouping`](../basesessionmodel#getter-numbergrouping)

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

From [DrawerWidgetSessionMixin](../drawerwidgetsessionmixin): [`visibleWidget`](../drawerwidgetsessionmixin#getter-visiblewidget), [`drawerVisible`](../drawerwidgetsessionmixin#getter-drawervisible), [`modalWidgetVisible`](../drawerwidgetsessionmixin#getter-modalwidgetvisible)


## Methods

3 inherited methods from one model:

From [BaseSessionModel](../basesessionmodel): [`getPreferenceDefault`](../basesessionmodel#method-getpreferencedefault), [`getPreference`](../basesessionmodel#method-getpreference), [`getPreferenceChanges`](../basesessionmodel#method-getpreferencechanges)


## Actions

| Member | Description |
| --- | --- |
| **moveViewDown**<br><code>(id: string, scopeIds?: string[] &#124; undefined) =&gt; void</code> |  |
| **moveViewUp**<br><code>(id: string, scopeIds?: string[] &#124; undefined) =&gt; void</code> |  |
| **moveViewToTop**<br><code>(id: string, scopeIds?: string[] &#124; undefined) =&gt; void</code> |  |
| **moveViewToBottom**<br><code>(id: string, scopeIds?: string[] &#124; undefined) =&gt; void</code> |  |
| **orderViews**<br><code>(ids: string[]) =&gt; void</code> | Put the named views into the given relative order, leaving views not named in their own slots.<br><br>`session.views` is the one ordering, so this is how a channel that states an order in some other vocabulary gets it applied: a session spec's `layout` names views per panel, top to bottom, and that used to be honoured by the panel assignment array's order. Now the assignment carries membership only, so the layout says it here instead, once. |
| **addView**<br><code>&lt;N extends string&gt;(typeName: N, initialState?: NoInfer&lt;ViewSnapshotInput&lt;N&gt;&gt; &#124; undefined) =&gt; any</code> | Requires the view type's state model to be loaded; for a lazily registered type use `launchView`. |
| **replaceView**<br><code>&lt;N extends string&gt;(view: IBaseViewModel, typeName: N, initialState?: NoInfer&lt;ViewSnapshotInput&lt;N&gt;&gt; &#124; undefined) =&gt; any</code> | swap `view` for a new view of `typeName`, in the slot it occupied.<br><br>The launchers that build a view of a DIFFERENT type out of one you are already looking at — launch synteny view, read-vs-ref, split view — otherwise append, leaving the source view above the thing it produced and a stack of two views showing the same locus. This is the "replace" half of that offer, and a slot swap rather than remove-then-add so the new view lands where the reader was looking instead of at the bottom of the session.<br><br>A launcher whose result is the SAME type as its source does not come here and should not: collapse introns offers "Replace current view" by navigating the view it was invoked on, which keeps the view's identity and so lets its snackbar offer an Undo. Swapping in a new node would leave nothing to undo onto.<br><br>The slot is `session.views`, which is the order views render in under both layout modes (a tab's `viewIds` says which tab a view is in, not where in it), so the swap lands in place either way.<br><br>WHICH panel is a separate question and this does not answer it: the new view arrives in no tab, and `homeUnassignedViews` puts it in the active panel — the same panel only when the replaced view was in the active one. In practice it is, since clicking into a view activates its panel, and the launch that offers a replace is a click on that view's own menu. |
| **removeView**<br><code>(view: IBaseViewModel) =&gt; void</code> |  |
| **takeOutViewsMissingFrom**<br><code>(snapshot: unknown) =&gt; void</code> | Take out every view the given session snapshot will not keep, before a whole-tree `applySnapshot` destroys it where it stands.<br><br>Undo and redo are `applySnapshot` on the session (`core/util/TimeTraveller`, which calls this), and every view carries an `ElementId` — so MST reconciles by identifier and destroys what the target lacks, inside the action, with the components still mounted. Measured on a redo across a closed view, with the restored view repainted first: 4 liveliness reads of its display before this, 0 after.<br><br>A view that is present but has changed `type` is destroyed by that same reconciliation (`areSame` runs the type's `is()` before its id check), so identity here is the pair, not the id.<br><br>**Views, and deliberately not what is under them.** A track or a display the snapshot drops is still destroyed in place, and that is not this door being worse than the others: `hideTrackGeneric` is a plain `tracks.remove` and measures louder (5 reads to undo's 4). Detaching one would be worse than the destroy it replaced — a detached display is a LIVE root, and `getContainingView` walks parents and throws when the walk finds no view, where a dead node only warns. At or above the view is the only place that walk still lands, which is why ADR-069's rule stops there. |
| **setStickyViewHeaders**<br><code>(sticky: boolean) =&gt; void</code> |  |
| **setUseWorkspaces**<br><code>(_useWorkspaces?: boolean &#124; undefined) =&gt; void</code> | Does nothing: the workspace is always on. Kept because published protein3d and msaview bundles call it after placing a view. |
| **launchView**<br><code>&lt;N extends string&gt;(typeName: N, initialState?: NoInfer&lt;ViewSnapshotInput&lt;N&gt;&gt; &#124; undefined) =&gt; Promise&lt;any&gt;</code> | `addView` for view types whose state model may be lazily loaded. The view is not in `session.views` until the promise resolves. `getViewType` first so an unknown type name fails by that name; the snapshot walk skips unregistered names and covers the displays of the tracks a launch opens with. |

39 inherited actions from 3 models:

From [BaseSessionModel](../basesessionmodel): [`setSelection`](../basesessionmodel#action-setselection), [`clearSelection`](../basesessionmodel#action-clearselection), [`setHovered`](../basesessionmodel#action-sethovered), [`setHighlightsVisible`](../basesessionmodel#action-sethighlightsvisible), [`setHighlightLabelsVisible`](../basesessionmodel#action-sethighlightlabelsvisible), [`addHighlight`](../basesessionmodel#action-addhighlight), [`removeHighlight`](../basesessionmodel#action-removehighlight), [`updateHighlight`](../basesessionmodel#action-updatehighlight), [`setHighlights`](../basesessionmodel#action-sethighlights), [`setPreferenceOverride`](../basesessionmodel#action-setpreferenceoverride), [`clearPreferenceOverrides`](../basesessionmodel#action-clearpreferenceoverrides), [`clearPreferenceOverride`](../basesessionmodel#action-clearpreferenceoverride), [`setScrollZoom`](../basesessionmodel#action-setscrollzoom), [`setName`](../basesessionmodel#action-setname), [`setFocusedViewId`](../basesessionmodel#action-setfocusedviewid), [`removeActiveDialog`](../basesessionmodel#action-removeactivedialog), [`queueDialog`](../basesessionmodel#action-queuedialog), [`removeDialog`](../basesessionmodel#action-removedialog)

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)

From [DrawerWidgetSessionMixin](../drawerwidgetsessionmixin): [`setDrawerPosition`](../drawerwidgetsessionmixin#action-setdrawerposition), [`updateDrawerWidth`](../drawerwidgetsessionmixin#action-updatedrawerwidth), [`resizeDrawer`](../drawerwidgetsessionmixin#action-resizedrawer), [`addWidget`](../drawerwidgetsessionmixin#action-addwidget), [`showWidget`](../drawerwidgetsessionmixin#action-showwidget), [`hideWidget`](../drawerwidgetsessionmixin#action-hidewidget), [`minimizeWidgetDrawer`](../drawerwidgetsessionmixin#action-minimizewidgetdrawer), [`showWidgetDrawer`](../drawerwidgetsessionmixin#action-showwidgetdrawer), [`popoutWidget`](../drawerwidgetsessionmixin#action-popoutwidget), [`returnWidgetToDrawer`](../drawerwidgetsessionmixin#action-returnwidgettodrawer), [`setModalWidgets`](../drawerwidgetsessionmixin#action-setmodalwidgets), [`hideAllWidgets`](../drawerwidgetsessionmixin#action-hideallwidgets), [`closeModalWidget`](../drawerwidgetsessionmixin#action-closemodalwidget), [`openWidget`](../drawerwidgetsessionmixin#action-openwidget), [`editConfiguration`](../drawerwidgetsessionmixin#action-editconfiguration)


