From 56ba9903dd632860e7999a1d45243cc8d9071676 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr>
Date: Fri, 28 Oct 2022 13:09:55 +0200
Subject: [PATCH] fix: ExpressionChangedAfterItHasBeenCheckedError when
 switching parameter to variated mode (form validity)

---
 .../dialog-edit-param-values.component.ts                      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts
index 29b6947db..16768e9c0 100644
--- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts
+++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts
@@ -279,7 +279,8 @@ export class DialogEditParamValuesComponent implements OnInit {
                 break;
 
             case ParamValueMode.MINMAX:
-                ret = this.minMaxForm !== undefined && this.minMaxForm.valid;
+                // return true when form is not initialised to avoid ExpressionChangedAfterItHasBeenCheckedError
+                ret = this.minMaxForm === undefined ? true : this.minMaxForm.valid;
                 break;
         }
         return ret;
-- 
GitLab