diff --git a/spug_web/src/pages/host/Group.js b/spug_web/src/pages/host/Group.js
index 657edb4..97b0d8b 100644
--- a/spug_web/src/pages/host/Group.js
+++ b/spug_web/src/pages/host/Group.js
@@ -28,14 +28,17 @@ export default observer(function () {
const [bakTreeData, setBakTreeData] = useState();
useEffect(() => {
- if (!loading) store.fetchGroups().then(() => {
- if (loading === undefined) {
- const tmp = store.treeData.filter(x => x.children.length)
- setExpands(tmp.map(x => x.key))
- }
- })
+ if (loading === false) store.fetchGroups()
}, [loading])
+ useEffect(() => {
+ if (store.treeData.length > 0 && expands === undefined) {
+ const tmp = store.treeData.filter(x => x.children.length)
+ setExpands(tmp.map(x => x.key))
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [store.treeData])
+
const menus = (