Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Aug 5, 2024
1 parent 6a6eab8 commit 21e58ad
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
2 changes: 0 additions & 2 deletions lib/src/components/header/HeaderMenuExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
24 changes: 23 additions & 1 deletion lib/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function stateModelFactory() {
* #volatile
* size of blocks of content to be drawn, px
*/
blockSize: 1000,
blockSize: 500,

/**
* #volatile
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions lib/src/model/DataModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
})
}
2 changes: 0 additions & 2 deletions lib/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ export function collapse(d: HierarchyNode<NodeWithIds>) {
// @ts-expect-error
d._children = d.children
// @ts-expect-error
// d._children.forEach(collapse)
// @ts-expect-error
d.children = null
}
}
Expand Down

0 comments on commit 21e58ad

Please sign in to comment.