diff --git a/lib/src/components/header/HeaderMenuExtra.tsx b/lib/src/components/header/HeaderMenuExtra.tsx index b3c977d1..35c6aa82 100644 --- a/lib/src/components/header/HeaderMenuExtra.tsx +++ b/lib/src/components/header/HeaderMenuExtra.tsx @@ -9,8 +9,6 @@ import Visibility from '@mui/icons-material/Visibility' import FilterAlt from '@mui/icons-material/FilterAlt' import Search from '@mui/icons-material/Search' import PhotoCamera from '@mui/icons-material/PhotoCamera' -import RestartAlt from '@mui/icons-material/RestartAlt' -import FolderOpen from '@mui/icons-material/FolderOpen' import Settings from '@mui/icons-material/Settings' import Assignment from '@mui/icons-material/Assignment' import List from '@mui/icons-material/List' diff --git a/lib/src/model.ts b/lib/src/model.ts index b7c04b34..2c5dd1c6 100644 --- a/lib/src/model.ts +++ b/lib/src/model.ts @@ -258,7 +258,7 @@ function stateModelFactory() { * #volatile * size of blocks of content to be drawn, px */ - blockSize: 1000, + blockSize: 500, /** * #volatile @@ -738,6 +738,17 @@ function stateModelFactory() { } return r }, + + /** + * #getter + */ + get colStatsSums() { + return Object.fromEntries( + Object.entries(this.colStats).map(([key, val]) => { + return [key, sum(Object.values(val))] + }), + ) + }, /** * #getter * generates a new tree that is clustered with x,y positions @@ -1321,6 +1332,17 @@ function stateModelFactory() { }), ) + addDisposer( + self, + autorun(() => { + // force colStats not to go stale, + // xref solution https://github.com/mobxjs/mobx/issues/266#issuecomment-222007278 + // xref problem https://github.com/GMOD/react-msaview/issues/75 + self.colStats + self.colStatsSums + self.columns + }), + ) // autorun synchronizes treeWidth with treeAreaWidth addDisposer( self, diff --git a/lib/src/model/DataModel.ts b/lib/src/model/DataModel.ts index 6cd09243..0542cb6b 100644 --- a/lib/src/model/DataModel.ts +++ b/lib/src/model/DataModel.ts @@ -43,4 +43,14 @@ export function DataModelF() { self.treeMetadata = treeMetadata }, })) + .postProcessSnapshot(snap => { + const { tree, msa, treeMetadata } = snap + const max = 50_000 + return { + tree: tree && tree.length > max ? undefined : tree, + msa: msa && msa.length > max ? undefined : msa, + treeMetadata: + treeMetadata && treeMetadata.length > max ? undefined : treeMetadata, + } + }) } diff --git a/lib/src/util.ts b/lib/src/util.ts index ad88d4d1..f5ec88de 100644 --- a/lib/src/util.ts +++ b/lib/src/util.ts @@ -106,8 +106,6 @@ export function collapse(d: HierarchyNode) { // @ts-expect-error d._children = d.children // @ts-expect-error - // d._children.forEach(collapse) - // @ts-expect-error d.children = null } }