Explorar el Código

trigger state initialization on formload/change

jusrhee hace 5 años
padre
commit
12b3a75471
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      dashboard/src/components/values-form/FormWrapper.tsx

+ 3 - 2
dashboard/src/components/values-form/FormWrapper.tsx

@@ -151,7 +151,7 @@ export default class FormWrapper extends Component<PropsType, StateType> {
   };
 
   componentDidMount() {
-    this.updateTabs();
+    this.updateTabs(true);
   }
 
   componentDidUpdate(prevProps: any) {
@@ -159,7 +159,8 @@ export default class FormWrapper extends Component<PropsType, StateType> {
       !_.isEqual(prevProps.tabOptions, this.props.tabOptions) ||
       !_.isEqual(prevProps.formData, this.props.formData)
     ) {
-      this.updateTabs();
+      let formHasChanged = !_.isEqual(prevProps.formData, this.props.formData);
+      this.updateTabs(formHasChanged);
     }
   }