fix: directory tree

This commit is contained in:
tao.chen
2026-08-12 20:45:29 +08:00
parent d600d5dbb1
commit 302bda2ee9
@@ -69,6 +69,10 @@ export function ScriptExplorer({
);
const byOwner = new Map<string, ScriptItem[]>();
// 当前用户的目录树即使没有脚本也要渲染,所以预置空组。
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 && (
<div className="tree-empty">
<span className="tree-empty__icon">
<Icon name="script" size={24} />