Explorar o código

keep old error states around

Sebastian Bittrich %!s(int64=3) %!d(string=hai) anos
pai
achega
850754c46c
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  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
             });
         });
     }