From 2de79abf635598cc9c248eafa94e2426ccf4101e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Thu, 13 Feb 2020 08:28:00 +0100
Subject: [PATCH] [ivette] simplify internal states

---
 ivette/src/frama-c/states.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ivette/src/frama-c/states.js b/ivette/src/frama-c/states.js
index 92308d76dd0..8477f4e7c79 100644
--- a/ivette/src/frama-c/states.js
+++ b/ivette/src/frama-c/states.js
@@ -72,7 +72,8 @@ export function setProject(project)
 export function clearProject(project)
 {
   const theProject = project || currentProject ;
-  _.unset( globalStates , ['states',theProject] );
+  if (theProject)
+    _.unset( globalStates , [theProject] );
   Dome.emit(PROJECT);
 }
 
@@ -101,7 +102,7 @@ export function useState(id,project)
   Dome.useUpdate(PROJECT,theEvent);
   const theProject = project || currentProject ;
   if (!theProject) return NONE;
-  const thePath = ['states',theProject,id] ;
+  const thePath = [theProject,id] ;
   const theValue = _.get( globalStates, thePath );
   const setValue = (v) => {
     Dome.emit(theEvent,v);
-- 
GitLab