Quellcode durchsuchen

checkbox global state bug fixed

bioinsilico vor 2 Jahren
Ursprung
Commit
91fd090319

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@rcsb/rcsb-saguaro-3d",
-  "version": "2.4.0-data-provider.16",
+  "version": "2.4.0-data-provider.17",
   "description": "RCSB Molstar/Saguaro Web App",
   "main": "build/dist/app.js",
   "files": [

+ 2 - 0
src/RcsbFv3D/RcsbFv3DComponent.tsx

@@ -149,7 +149,9 @@ export class RcsbFv3DComponent<T,R,L,S,U> extends React.Component <RcsbFv3DCompo
 
     /**Unsubscribe className to rxjs events. Useful if many panels are created an destroyed.*/
     private unsubscribe(): void{
+        console.warn('Unsubscribing all observers');
         this.subscription.unsubscribe();
+        this.stateManager.unsubscribe();
     }
 
     private updateConfig(config:UpdateConfigInterface<T,R,S,U>){

+ 2 - 1
src/RcsbFvSequence/SequenceViews/RcsbView/PfvManagerFactoryImplementation/MsaPfvComponents/MsaRowTitleCheckboxComponent.tsx

@@ -23,7 +23,7 @@ interface MsaRowTitleCheckboxState {
 }
 
 //TODO keeps a global state of the (checkboxes <=> mol-star components) This needs further review!!!
-const globalState: {[key:string]: "active"|"inactive"|"disabled"|undefined;} = {};
+let globalState: {[key:string]: "active"|"inactive"|"disabled"|undefined;} = {};
 
 export class MsaRowTitleCheckboxComponent extends React.Component <MsaRowTitleCheckboxType,MsaRowTitleCheckboxState> {
 
@@ -75,6 +75,7 @@ export class MsaRowTitleCheckboxComponent extends React.Component <MsaRowTitleCh
 
     public componentWillUnmount() {
         this.subscription.unsubscribe();
+        globalState = {};
     }
 
     private subscribe(): void{

+ 1 - 2
src/RcsbFvState/RcsbFvStateInterface.ts

@@ -20,9 +20,8 @@ export interface RcsbFvStateInterface {
     readonly assemblyModelSate: AssemblyModelSate;
     readonly subject: Subject<RcsbFvStateType<any,any>>
 
-
     subscribe<T,D>(o:(state:RcsbFvStateType<T,D>)=>void): Subscription;
-
     next<T,D>(state:RcsbFvStateType<T,D>): void;
+    unsubscribe(): void;
 
 }

+ 4 - 0
src/RcsbFvState/RcsbFvStateManager.ts

@@ -23,4 +23,8 @@ export class RcsbFvStateManager implements RcsbFvStateInterface {
        return  this.subject.subscribe(o);
     }
 
+    unsubscribe(): void {
+        this.subject.unsubscribe();
+    }
+
 }

+ 4 - 4
src/RcsbFvStructure/StructureViewers/MolstarViewer/MolstarUtils/MolstarComponentAction.ts

@@ -22,15 +22,15 @@ class MolstarComponentAction implements ComponentActionInterface<LoadMolstarRetu
         const components = trajectory.representation?.components;
         if(!components)
             return;
-        if(!components["polymer"]){
+        if(!components["polymer"]) {
             this.stateManager.next<
                 "missing-component",
-                {tag:"aligned"|"polymer"|"non-polymer";entryId:string;entityId:string;}|{tag:"aligned"|"polymer"|"non-polymer";entryId:string;instanceId:string;}
+                { tag: "aligned" | "polymer" | "non-polymer"; entryId: string; entityId: string; } | { tag: "aligned" | "polymer" | "non-polymer"; entryId: string; instanceId: string; }
             >({
-                type:"missing-component",
+                type: "missing-component",
                 view: "3d-view",
                 data: {
-                    tag:"polymer",
+                    tag: "polymer",
                     ...context
                 }
             });