diff --git a/src/mol-plugin/ui/state/tree.tsx b/src/mol-plugin/ui/state/tree.tsx index 6bd6d173af261f7e40bfdf57fd80c8ebafaee27a..5e0815d2ddfad753444edfd0fdb457d840ce453c 100644 --- a/src/mol-plugin/ui/state/tree.tsx +++ b/src/mol-plugin/ui/state/tree.tsx @@ -53,9 +53,10 @@ class StateTreeNode extends PluginUIComponent<{ cell: StateObjectCell, depth: nu componentDidMount() { this.subscribe(this.plugin.events.state.cell.stateUpdated, e => { if (this.props.cell === e.cell && this.is(e) && e.state.cells.has(this.ref)) { - if (!!this.props.cell.state.isCollapsed !== this.state.isCollapsed) { - this.setState({ isCollapsed: !!e.cell.state.isCollapsed }); - } + this.forceUpdate(); + // if (!!this.props.cell.state.isCollapsed !== this.state.isCollapsed) { + // this.setState({ isCollapsed: !!e.cell.state.isCollapsed }); + // } } }); @@ -83,7 +84,9 @@ class StateTreeNode extends PluginUIComponent<{ cell: StateObjectCell, depth: nu render() { const cell = this.props.cell; - if (!cell || cell.obj === StateObject.Null) return null; + if (!cell || cell.obj === StateObject.Null) { + return null; + } const cellState = cell.state; const showLabel = cell.status !== 'ok' || !cell.state.isGhost; diff --git a/src/mol-state/transform.ts b/src/mol-state/transform.ts index 5c99cbb043dcc24c08fc59434e44905b2c40e768..0e11a042e5aea271a1bcb0fdc3824b4dfd0d0872 100644 --- a/src/mol-state/transform.ts +++ b/src/mol-state/transform.ts @@ -52,6 +52,7 @@ namespace Transform { export function assignState(a: State, b?: Partial<State>): boolean { if (!b) return false; + let changed = false; for (const k of Object.keys(b)) { const s = (b as any)[k], t = (a as any)[k]; @@ -59,6 +60,12 @@ namespace Transform { changed = true; (a as any)[k] = s; } + for (const k of Object.keys(a)) { + const s = (b as any)[k], t = (a as any)[k]; + if (!!s === !!t) continue; + changed = true; + (a as any)[k] = s; + } return changed; }