From b22fbccac6b7ad85dabd0aa6850ba3e296fd13cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Correnson?= <loic.correnson@cea.fr>
Date: Mon, 17 Jun 2024 15:41:18 +0200
Subject: [PATCH] [region/ivette] upgrade use-request

---
 ivette/src/frama-c/plugins/region/api/index.ts | 4 ++++
 ivette/src/frama-c/plugins/region/index.tsx    | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ivette/src/frama-c/plugins/region/api/index.ts b/ivette/src/frama-c/plugins/region/api/index.ts
index 8d4530d2f54..5d01bdbe22a 100644
--- a/ivette/src/frama-c/plugins/region/api/index.ts
+++ b/ivette/src/frama-c/plugins/region/api/index.ts
@@ -149,6 +149,7 @@ const compute_internal: Server.ExecRequest<decl,null> = {
   name: 'plugins.region.compute',
   input: jDecl,
   output: Json.jNull,
+  fallback: null,
   signals: [],
 };
 /** Compute regions for the given declaration */
@@ -159,6 +160,7 @@ const regions_internal: Server.GetRequest<decl,region[]> = {
   name: 'plugins.region.regions',
   input: jDecl,
   output: Json.jArray(jRegion),
+  fallback: [],
   signals: [ { name: 'plugins.region.updated' } ],
 };
 /** Returns computed regions for the given declaration */
@@ -169,6 +171,7 @@ const regionsAt_internal: Server.GetRequest<[ marker, boolean ],region[]> = {
   name: 'plugins.region.regionsAt',
   input: Json.jPair( jMarker, Json.jBoolean,),
   output: Json.jArray(jRegion),
+  fallback: [],
   signals: [ { name: 'plugins.region.updated' } ],
 };
 /** Compute regions at the given marker */
@@ -183,6 +186,7 @@ const localize_internal: Server.GetRequest<
   name: 'plugins.region.localize',
   input: Json.jPair( jMarker, Json.jBoolean,),
   output: Json.jOption(jNode),
+  fallback: undefined,
   signals: [ { name: 'plugins.region.updated' } ],
 };
 /** Localize in the local (true) or global map (false) */
diff --git a/ivette/src/frama-c/plugins/region/index.tsx b/ivette/src/frama-c/plugins/region/index.tsx
index d489e0a5a21..eed8bea5b81 100644
--- a/ivette/src/frama-c/plugins/region/index.tsx
+++ b/ivette/src/frama-c/plugins/region/index.tsx
@@ -45,8 +45,7 @@ function RegionAnalys(): JSX.Element {
   const setComputing = Dome.useProtected(setRunning);
   const scope = States.useCurrentScope();
   const { kind, name } = States.useDeclaration(scope);
-  const regions =
-    States.useRequest(Region.regions, kf, { pending: null }) ?? [];
+  const regions = States.useRequestStable(Region.regions, kf);
   React.useEffect(() => {
     if (!pinned && kind === 'FUNCTION' && scope !== kf) {
       setKf(scope);
-- 
GitLab