From 37fb000bb4fc9408034347a8400909c7eb0dcb58 Mon Sep 17 00:00:00 2001
From: "mathias.chouet" <mathias.chouet@irstea.fr>
Date: Wed, 3 Jul 2019 11:58:50 +0200
Subject: [PATCH] fix jalhyd#106 PAB deserialisation

---
 src/app/services/formulaire/formulaire.service.ts | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 7433bb631..a7ba491b3 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -334,8 +334,13 @@ export class FormulaireService extends Observable {
             }
 
             // when creating a new Pab, add one wall with one device, plus the downwall
-            // (when loading session only)
-            if (f instanceof FormulairePab && f.currentNub instanceof Pab) {
+            // (when loading session, those items are already present)
+            if (
+                f instanceof FormulairePab
+                && f.currentNub instanceof Pab
+                && f.currentNub.children.length === 0
+                && f.currentNub.downWall === undefined
+            ) {
                 // 1. one wall
                 const newWall = Session.getInstance().createNub(
                     new Props({
-- 
GitLab