Browse Source

mol-plugin-ui unsubscribe events

David Sehnal 5 years ago
parent
commit
f3b6703fd4
2 changed files with 3 additions and 5 deletions
  1. 2 0
      src/mol-plugin-ui/sequence/sequence.tsx
  2. 1 5
      src/mol-plugin-ui/state/common.tsx

+ 2 - 0
src/mol-plugin-ui/sequence/sequence.tsx

@@ -65,6 +65,8 @@ export class Sequence<P extends SequenceProps> extends PluginUIComponent<P> {
     }
 
     componentWillUnmount() {
+        super.componentWillUnmount();
+
         this.plugin.managers.interactivity.lociHighlights.removeProvider(this.lociHighlightProvider)
         this.plugin.managers.interactivity.lociSelects.removeProvider(this.lociSelectionProvider)
     }

+ 1 - 5
src/mol-plugin-ui/state/common.tsx

@@ -122,7 +122,7 @@ abstract class TransformControlBase<P, S extends TransformControlBase.ComponentS
     abstract getSourceAndTarget(): { a?: StateObject, b?: StateObject };
     abstract state: S;
 
-    private busy: Subject<boolean>;
+    private busy: Subject<boolean> = new Subject();
 
     private onEnter = () => {
         if (this.state.error) return;
@@ -165,10 +165,6 @@ abstract class TransformControlBase<P, S extends TransformControlBase.ComponentS
 
     componentDidMount() {
         this.subscribe(this.plugin.behaviors.state.isBusy, b => this.busy.next(b));
-    }
-
-    init() {
-        this.busy = new Subject();
         this.subscribe(this.busy, busy => this.setState({ busy }));
     }