Browse Source

mol-plugin: tweaks

David Sehnal 6 years ago
parent
commit
5fed559334
2 changed files with 4 additions and 2 deletions
  1. 2 1
      src/mol-plugin/ui/plugin.tsx
  2. 2 1
      src/mol-plugin/ui/state-tree.tsx

+ 2 - 1
src/mol-plugin/ui/plugin.tsx

@@ -32,7 +32,8 @@ export class Plugin extends React.Component<{ plugin: PluginContext }, { }> {
 }
 
 export class _test_CurrentObject extends React.Component<{ plugin: PluginContext }, { }> {
-    componentWillMount() {
+    componentDidMount() {
+        // TODO: move to constructor?
         this.props.plugin.behaviors.state.data.currentObject.subscribe(() => this.forceUpdate());
     }
     render() {

+ 2 - 1
src/mol-plugin/ui/state-tree.tsx

@@ -11,7 +11,8 @@ import { StateObject } from 'mol-state'
 import { PluginCommands } from 'mol-plugin/command';
 
 export class StateTree extends React.Component<{ plugin: PluginContext }, { }> {
-    componentWillMount() {
+    componentDidMount() {
+        // TODO: move to constructor?
         this.props.plugin.events.state.data.updated.subscribe(() => this.forceUpdate());
     }
     render() {