Skip to content
Snippets Groups Projects
Commit 254a9442 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

fix: remove fix validation frontend

parent 5fb7c744
No related branches found
No related tags found
No related merge requests found
......@@ -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);
})),
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment