From 0817793961918c1123328bca9a78ca29d95738b8 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 28 三月 2024 14:54:27 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
index 4afd377..93b021f 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -23,20 +23,30 @@
     const intl = useIntl();
     const { styles } = useStyles();
     const refContainer = useRef();
-    const [loading, setLoading] = React.useState(true);
+    const [loading, setLoading] = React.useState(false);
+
+    const startThree = () => {
+        shelfThree = new ShelfThree(refContainer.current);
+        shelfThree.startup();
+    }
+
+    const endThree = () => {
+        if (shelfThree) {
+            shelfThree.destroy();
+            shelfThree = null;
+        }
+    }
 
     useEffect(() => {
-        console.log(props);
+        setLoading(true);
+        endThree();
         setTimeout(() => {
             setLoading(false);
-            shelfThree = new ShelfThree(refContainer.current);
-            shelfThree.startup();
-        }, 1000)
+            startThree();
+        }, 300)
 
-        return () => {
-            shelfThree?.destroy();
-        }
-    }, [props]);
+        return endThree;
+    }, [props.data.uuid]);
 
     return (
         <>

--
Gitblit v1.9.1