From dfa65ec175cb18593408166212ae0140bf6546b8 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Wed, 10 Feb 2021 14:54:08 +0100
Subject: [PATCH] fix(form): bug homePage blink on editForm

---
 src/app/form/form.component.html | 2 +-
 src/app/form/form.component.ts   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html
index fcac27064..d495e9ef1 100644
--- a/src/app/form/form.component.html
+++ b/src/app/form/form.component.html
@@ -4,7 +4,7 @@
     [content]="'Il vous faudra de nouveau remplir le formulaire si vous quittez'"
     (closed)="hasRedirectionAccepted($event)"
   ></app-modal-confirmation>
-  <div class="content" [ngClass]="{ editMode: isEditMode }">
+  <div class="content" *ngIf="!isLoading" [ngClass]="{ editMode: isEditMode }">
     <div class="returnBtnSection" *ngIf="isEditMode && currentPage != 0">
       <button class="btn-primary previous" (click)="goToSpecificPage(0, false)">
         <div class="rowBtn" fxLayout="row" fxLayoutAlign="center center">
diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index 55847505a..94fc88cb6 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -62,6 +62,7 @@ export class FormComponent implements OnInit {
   public userAcceptSavedDate = false;
   public showMenu = false;
   public isEditMode = false;
+  public isLoading = false;
 
   constructor(
     private structureService: StructureService,
@@ -72,11 +73,13 @@ export class FormComponent implements OnInit {
   ) {}
 
   async ngOnInit(): Promise<void> {
+    this.isLoading = true;
     this.profileService.getProfile().then((user: User) => {
       this.profile = user;
     });
     await this.setCategories();
     // Check if it's a new structure or edit structure
+    this.isLoading = false;
     if (history.state.data) {
       this.isEditMode = true;
       this.initForm(new Structure(history.state.data));
-- 
GitLab