Kaynağa Gözat

keep old error states around

Sebastian Bittrich 3 yıl önce
ebeveyn
işleme
850754c46c
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      src/viewer/ui/validation.tsx

+ 5 - 2
src/viewer/ui/validation.tsx

@@ -42,10 +42,13 @@ export class ValidationReportControls extends CollapsableControls<{}, Validation
 
     componentDidMount() {
         this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection, () => {
+            const { errorStates, description } = this.state;
+            const nextDescription = StructureHierarchyManager.getSelectedStructuresDescription(this.plugin);
             this.setState({
                 isHidden: !this.canEnable(),
-                errorStates: new Set<string>(),
-                description: StructureHierarchyManager.getSelectedStructuresDescription(this.plugin)
+                // if structure is unchanged then keep old error states
+                errorStates: nextDescription === description ? errorStates : new Set<string>(),
+                description: nextDescription
             });
         });
     }