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 && (