JBrowseWebRootModel
Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the developer guide for concepts. View source.
Holds JBrowse Web's top-level state: the loaded config, the session, internet accounts, undo history, the app menus and the saved sessions kept in the browser.
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 |
|---|---|
configPathconfigPath: types.maybe(types.string) |
6 inherited properties from 3 models
From BaseRootModel: jbrowse, session, sessionPath, assemblyManager
Volatiles
| Member | Description |
|---|---|
adminModeboolean | |
sessionDBSessionDBHandle | undefined | |
versionstring | |
gitCommitstring | |
pluginsUpdatedboolean | |
savedSessionMetadataSessionMetadata[] | undefined | |
detachDisposers(() => void)[] | 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.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 |
5 inherited volatiles from 2 models
From BaseRootModel: rpcManager, error, textSearchManager, pluginManager
From RootAppMenuMixin:
Methods
| Member | Description |
|---|---|
() => Menu[] |
Actions
| Member | Description |
|---|---|
setSavedSessionMetadata(sessions: SessionMetadata[]) => void | |
fetchSessionMetadata() => Promise<void> | 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(meta: SessionMetadata) => void | Merges a row this model has just written into the in-memory list. The autosave autorun writes exactly one row on every throttled 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(sessionDB: SessionDBHandle | undefined) => void | |
addDetachDisposer(disposer: () => void) => void | Register something that must stop when the React host detaches this root. See the detachDisposers volatile for why this is not addDisposer. |
detach() => void | 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.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() => void | |
| setReloadPluginManagerCallback | |
activateSession(id: string) => Promise<void> | |
openSessionCopy(snap: Record<string, unknown>) => Promise<void> | Opens a session snapshot under a fresh id, so it autosaves beside the session it came from rather than over it. |
setSavedSessionFavorite(id: string, favorite: boolean) => Promise<void> | |
deleteSavedSession(id: string) => Promise<void> | |
deleteSavedSessions(ids: string[]) => Promise<void> | 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.The open session is skipped rather than reported on, since a bulk delete is not aimed at any one row (see deleteSavedSession). |
renameSavedSession(id: string, name: string) => Promise<void> |
14 inherited actions from 3 models
From BaseRootModel: setError, setSession, setDefaultSession, setSessionPath, renameCurrentSession
From InternetAccountsMixin: initializeInternetAccount, createEphemeralInternetAccount, findAppropriateInternetAccount
From RootAppMenuMixin: , , , , ,