From 254a94424cc7375e30788985d68f45b5d4b6553f Mon Sep 17 00:00:00 2001
From: Florent Poittevin <florent.poittevin@unige.ch>
Date: Wed, 23 Oct 2019 12:11:05 +0200
Subject: [PATCH] fix: remove fix validation frontend

---
 .../shared-validation.directive.ts              | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/src/app/shared/directives/shared-validation/shared-validation.directive.ts b/src/app/shared/directives/shared-validation/shared-validation.directive.ts
index 8636f9263..f788bf336 100644
--- a/src/app/shared/directives/shared-validation/shared-validation.directive.ts
+++ b/src/app/shared/directives/shared-validation/shared-validation.directive.ts
@@ -21,7 +21,6 @@ import {
 import {
   isArray,
   isEmptyArray,
-  isFalse,
   isNullOrUndefined,
   ObjectUtil,
 } from "solidify-frontend";
@@ -58,27 +57,11 @@ export class SharedValidationDirective extends SharedAbstractDirective implement
 
   ngOnInit(): void {
     FormValidationHelper.initMetadataErrors(this._ngControl.control);
-    let isDetectChangesFromParent = false; // This hack prevent in most case infinity loop call stack error due to parent update change
-    // TODO Find a clean way working at 100%. In some case we get call stack error when change access level in deposit create form...
-
-    this.subscribe(this._ngControl.control.parent.statusChanges.pipe(
-      tap(validity => {
-        if (isFalse(isDetectChangesFromParent)) {
-          // Allow to display frontend validation error when the field is not updated with backend error
-          this._changeDetector.detectChanges();
-        }
-        isDetectChangesFromParent = true;
-      })),
-    );
-
     this.updateErrorsMetadatas(this._ngControl.control.status as FormState);
     this.subscribe(this._ngControl.control.statusChanges.pipe(
       filter(s => this.isDifferent()),
       tap(validity => {
         this.updateErrorsMetadatas(validity);
-        setTimeout(() => {
-          isDetectChangesFromParent = false;
-        }, 1000);
       })),
     );
   }
-- 
GitLab