Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,31 @@ export function useDashboardSidebarData() {
sectionMap: _sectionMap,
...sidebarProject
} = resolvedProject;
sidebarProject.children = childEntries

const sortedChildren = childEntries
.sort((left, right) => left.tabOrder - right.tabOrder)
.map(({ child }) => child);

// Ungrouped workspaces rendered after a section header are visually
// grouped with that section (shared accent, collapse-together) and will
// be committed into it on next DnD. Reparent them here so section counts
// match what the user sees.
const children: DashboardSidebarProjectChild[] = [];
let currentSection: DashboardSidebarSection | null = null;
for (const child of sortedChildren) {
if (child.type === "section") {
currentSection = child.section;
children.push(child);
} else if (currentSection) {
currentSection.workspaces.push({
...child.workspace,
accentColor: currentSection.color,
});
} else {
children.push(child);
}
}
sidebarProject.children = children;
Comment on lines +328 to +351
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

pending workspace はセクションへ再親化しないでください。

Line 342 の条件だと、Line 310〜315 で追加された pending workspace も PENDING_WORKSPACE_TAB_ORDER により最後に並び、セクションが1つでもあるプロジェクトでは最後のセクション配下へ移動します。作成中/失敗中の workspace が section count に含まれたり、セクションの collapse に巻き込まれたりするため、pending はトップレベルのまま残すのが安全です。

修正案
-				} else if (currentSection) {
+				} else if (currentSection && child.workspace.creationStatus == null) {
 					currentSection.workspaces.push({
 						...child.workspace,
 						accentColor: currentSection.color,
 					});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts`
around lines 328 - 351,
子要素をセクションへ再親化するループ(sortedChildren→currentSection→children)で、PENDING_WORKSPACE_TAB_ORDER
によって追加された「pending workspace」をセクション配下へ移動しないようにしてください:つまり useDashboardSidebarData
のループ内で child が pending を表すかどうかを PENDING_WORKSPACE_TAB_ORDER(または
child.workspace.tabOrder がそれに等しいこと)で判定し、その場合は currentSection があっても
currentSection.workspaces に入れずに children にそのまま push
するように修正してください(対象シンボル:sortedChildren, currentSection, children,
sidebarProject.children, PENDING_WORKSPACE_TAB_ORDER)。

return [sidebarProject];
});
}, [
Expand Down
Loading