upstream取り込み: v2 sidebar section count fix (#3544)#315
Conversation
…spaces (superset-sh#3544) Ungrouped workspaces that render after a section header are already visually grouped with that section (shared accent color, collapse together) and get committed into it on next drag. The count, however, was reading section.workspaces which only included workspaces whose DB sectionId already matched — so a freshly created section showed "(0)" while the user sees N workspaces beneath it. Reparent those workspaces into section.workspaces in the data layer so the count matches the visual grouping and DnD commit behavior.
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts`:
- Around line 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)。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7a2b8883-ae31-4828-99b2-09971158793d
📒 Files selected for processing (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/hooks/useDashboardSidebarData/useDashboardSidebarData.ts
| 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; |
There was a problem hiding this comment.
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)。
…al dim sync) - 1979f4c fix(desktop): v2 sidebar section count reflects visually grouped workspaces (superset-sh#3544) → PR #315 (clean cherry-pick) - 867ef87 fix(desktop): sync v1 terminal dimensions to backend on connect (superset-sh#3545) → PR #316 (manual port for fork cold-restore divergence)
概要
upstream から v2 sidebar の section count 表示 fix を取り込む PR。behind 2 → 1(残り 867ef87 は別 PR で手動移植)。
取り込み commit
1979f4caefork 適応修正
なし。
useDashboardSidebarData.tsへの clean apply。検証
Codex pre-review
Yes(fork衝突低、git apply --check clean)。
テストチェックリスト
Summary by CodeRabbit
リリースノート