From 302bda2ee9378ca8ac686fd7e69ae2ab411b9bcc Mon Sep 17 00:00:00 2001 From: "tao.chen" <93983997+taochen-ct@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:45:29 +0800 Subject: [PATCH] fix: directory tree --- frontend/app/components/platform/ScriptExplorer.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/app/components/platform/ScriptExplorer.tsx b/frontend/app/components/platform/ScriptExplorer.tsx index 9fecd48..399f4d0 100644 --- a/frontend/app/components/platform/ScriptExplorer.tsx +++ b/frontend/app/components/platform/ScriptExplorer.tsx @@ -69,6 +69,10 @@ export function ScriptExplorer({ ); const byOwner = new Map(); + // 当前用户的目录树即使没有脚本也要渲染,所以预置空组。 + if (user?.user_id) { + byOwner.set(user.user_id, []); + } for (const item of visibleScripts) { const list = byOwner.get(item.owner_user_id) ?? []; list.push(item); @@ -201,7 +205,7 @@ export function ScriptExplorer({ /> ); })} - {filteredScripts.length === 0 && ( + {filteredScripts.length === 0 && directories.length === 0 && (