From d47e4c70e920d2a4169054aa7e16eabbdd30c3e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Wed, 1 May 2024 10:20:53 +0200
Subject: [PATCH] [ivette] encode normal views with custom 0

---
 ivette/src/ivette/laboratory.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ivette/src/ivette/laboratory.tsx b/ivette/src/ivette/laboratory.tsx
index 01728248a92..91e2a834f48 100644
--- a/ivette/src/ivette/laboratory.tsx
+++ b/ivette/src/ivette/laboratory.tsx
@@ -54,7 +54,7 @@ interface Layout { A: compId, B: compId, C: compId, D: compId }
 interface TabViewState {
   key: tabKey, /* viewId@custom for custom, or viewId */
   viewId: viewId,
-  custom: number, /* -1: transient, n: custom */
+  custom: number, /* 0: normal, n>0: custom */
   split: Split,
   stack: Layout[], /* current at index 0 */
 }
@@ -487,7 +487,7 @@ function applyView(view: Ivette.ViewLayoutProps): void {
     const panels = addPanels(state.panels, layout);
     const alerts = removeAlerts(state.alerts, layout);
     const tabs = copyMap(state.tabs);
-    const tab = newTab(tabs, view, -1);
+    const tab = newTab(tabs, view, 0);
     saveTab(tabs, state);
     LAB.setValue({
       ...state,
@@ -1349,7 +1349,7 @@ function TabView(props: TabViewProps): JSX.Element | null {
     Dome.popupMenu([
       { label: 'Display View', enabled: !selected, onClick: onDisplay },
       { label: 'Restore Default', enabled: modified, onClick: onRestore },
-      { label: 'Close Tab', display: custom < 0, onClick: onClose },
+      { label: 'Close Tab', display: custom <= 0, onClick: onClose },
     ]);
   };
 
-- 
GitLab