# JBrowseWebRootModel

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. [View source](https://github.com/GMOD/jbrowse-components/blob/main/products/jbrowse-web/src/rootModel/rootModel.ts).

note: many properties of the root model are available through the session,
and we generally prefer using the session model (via e.g. getSession) over
the root model (via e.g. getRoot) in plugin code

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

## Properties

| Member | Description |
| --- | --- |
| **configPath**<br><code>configPath: types.maybe(types.string)</code> |  |

From [BaseRootModel](../baserootmodel): [`jbrowse`](../baserootmodel#property-jbrowse), [`session`](../baserootmodel#property-session), [`sessionPath`](../baserootmodel#property-sessionpath), [`assemblyManager`](../baserootmodel#property-assemblymanager)

From [InternetAccountsMixin](../internetaccountsmixin): [`internetAccounts`](../internetaccountsmixin#property-internetaccounts)

From [HistoryManagementMixin](../historymanagementmixin): [`history`](../historymanagementmixin#property-history)

## Volatiles

| Member | Description |
| --- | --- |
| **adminMode**<br><code>boolean</code> |  |
| **sessionDB**<br><code>SessionDBHandle &#124; undefined</code> |  |
| **version**<br><code>string</code> |  |
| **gitCommit**<br><code>string</code> |  |
| **pluginsUpdated**<br><code>false</code> |  |
| **savedSessionMetadata**<br><code>SessionMetadata[] &#124; undefined</code> |  |
| **detachDisposers**<br><code>(() =&gt; void)[]</code> | What has to stop the moment the React host lets go of this root — the `beforeunload` listener and the autoruns that write to sessionStorage and IndexedDB, i.e. everything reaching outside the tree.<br><br>Deliberately not `addDisposer`, which fires only on destroy, because destroy is what this root cannot do at detach time: React is still holding its views and widgets in the outgoing props of the same passive-effect flush. The destroy follows on a later task, so an `addDisposer` here would run late rather than never — but "the moment the host lets go" is the contract these want. See `detach` and SessionLoader's disposePluginManager. |
| **reloadPluginManagerCallback**<br><code>(_configSnapshot: Record&lt;string, unknown&gt;, _sessionSnapshot: Record&lt;string, unknown&gt;) =&gt; void</code> |  |

From [BaseRootModel](../baserootmodel): [`rpcManager`](../baserootmodel#volatile-rpcmanager), [`error`](../baserootmodel#volatile-error), [`textSearchManager`](../baserootmodel#volatile-textsearchmanager), [`pluginManager`](../baserootmodel#volatile-pluginmanager)

From [RootAppMenuMixin](../rootappmenumixin): [`mutableMenuActions`](../rootappmenumixin#volatile-mutablemenuactions)

## Methods

| Member | Description |
| --- | --- |
| **menus**<br><code>() =&gt; Menu[]</code> |  |

## Actions

| Member | Description |
| --- | --- |
| **setSavedSessionMetadata**<br><code>(sessions: SessionMetadata[]) =&gt; void</code> |  |
| **fetchSessionMetadata**<br><code>() =&gt; Promise&lt;void&gt;</code> | Re-reads the whole `metadata` store. For anything that changes rows this model didn't just write itself (first load, pruning, favorite, rename, delete) — the autosave path uses `upsertSessionMetadata` instead. |
| **upsertSessionMetadata**<br><code>(meta: SessionMetadata) =&gt; void</code> | Merges a row this model has just written into the in-memory list. The autosave autorun writes exactly one row on every debounced session edit — every 400ms for as long as you keep panning — and already holds its contents, so re-reading every session's metadata to learn what it just stored is the expensive way to move one row to the top. |
| **setSessionDB**<br><code>(sessionDB: SessionDBHandle &#124; undefined) =&gt; void</code> |  |
| **addDetachDisposer**<br><code>(disposer: () =&gt; void) =&gt; void</code> | Register something that must stop when the React host detaches this root. See the `detachDisposers` volatile for why this is not `addDisposer`. |
| **detach**<br><code>() =&gt; void</code> | Called when the React host releases this root. Stops everything the root runs outside the tree (the worker pool, the `beforeunload` listener, the sessionStorage and IndexedDB autoruns) and leaves the tree itself alone.<br><br>The caller destroys the tree on a later task (`scheduleDetachedDestroy`), which runs the `beforeDestroy` hooks in it; plugins rely on those hooks, so the destroy cannot be skipped. This action stops the outside work immediately, so none of it runs between detach and destroy. ADR-069. |
| **setPluginsUpdated**<br><code>() =&gt; void</code> |  |
| **setReloadPluginManagerCallback**<br><code>(callback: (configSnapshot: Record&lt;string, unknown&gt;, sessionSnapshot: Record&lt;string, unknown&gt;) =&gt; void) =&gt; void</code> |  |
| **activateSession**<br><code>(id: string) =&gt; Promise&lt;void&gt;</code> |  |
| **openSessionCopy**<br><code>(snap: Record&lt;string, unknown&gt;) =&gt; Promise&lt;void&gt;</code> | Opens a session snapshot under a fresh id, so it autosaves beside the session it came from rather than over it. |
| **setSavedSessionFavorite**<br><code>(id: string, favorite: boolean) =&gt; Promise&lt;void&gt;</code> |  |
| **deleteSavedSession**<br><code>(id: string) =&gt; Promise&lt;void&gt;</code> |  |
| **deleteSavedSessions**<br><code>(ids: string[]) =&gt; Promise&lt;void&gt;</code> | Deletes a batch of saved sessions in ONE transaction, and re-reads the metadata once at the end. Looping `deleteSavedSession` instead is both N transactions and N full `getAll('metadata')` scans, and — because those interleave — leaves `savedSessionMetadata` holding whichever scan happened to resolve last, so already-deleted rows stay on screen until something else refreshes the list.<br><br>The open session is skipped rather than reported on, since a bulk delete is not aimed at any one row (see deleteSavedSession). |
| **renameSavedSession**<br><code>(id: string, name: string) =&gt; Promise&lt;void&gt;</code> |  |

From [BaseRootModel](../baserootmodel): [`setError`](../baserootmodel#action-seterror), [`setSession`](../baserootmodel#action-setsession), [`setDefaultSession`](../baserootmodel#action-setdefaultsession), [`setSessionPath`](../baserootmodel#action-setsessionpath), [`renameCurrentSession`](../baserootmodel#action-renamecurrentsession)

From [InternetAccountsMixin](../internetaccountsmixin): [`initializeInternetAccount`](../internetaccountsmixin#action-initializeinternetaccount), [`createEphemeralInternetAccount`](../internetaccountsmixin#action-createephemeralinternetaccount), [`findAppropriateInternetAccount`](../internetaccountsmixin#action-findappropriateinternetaccount)

From [RootAppMenuMixin](../rootappmenumixin): [`appendMenu`](../rootappmenumixin#action-appendmenu), [`insertMenu`](../rootappmenumixin#action-insertmenu), [`appendToMenu`](../rootappmenumixin#action-appendtomenu), [`insertInMenu`](../rootappmenumixin#action-insertinmenu), [`appendToSubMenu`](../rootappmenumixin#action-appendtosubmenu), [`insertInSubMenu`](../rootappmenumixin#action-insertinsubmenu)

