From c9359978f96eb21b3cd08019bdc4e8d65dab1f7c Mon Sep 17 00:00:00 2001
From: GyDi <zzzgydi@gmail.com>
Date: Mon, 21 Nov 2022 23:06:32 +0800
Subject: [PATCH] fix: show global when no rule groups

---
 src/components/proxy/use-render-list.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/components/proxy/use-render-list.ts b/src/components/proxy/use-render-list.ts
index 8518a7a..b11a462 100644
--- a/src/components/proxy/use-render-list.ts
+++ b/src/components/proxy/use-render-list.ts
@@ -44,7 +44,9 @@ export const useRenderList = (mode: string) => {
     // global 和 direct 使用展开的样式
     const useRule = mode === "rule" || mode === "script";
     const renderGroups =
-      (useRule ? proxiesData?.groups : [proxiesData?.global!]) || [];
+      (useRule && proxiesData.groups.length
+        ? proxiesData.groups
+        : [proxiesData.global!]) || [];
 
     const retList = renderGroups.flatMap((group) => {
       const headState = headStates[group.name] || DEFAULT_STATE;
-- 
GitLab