Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 列表模式下散排对话之间不再叠出两根分割线

Dash8e58ed5d8a2e
diff --git a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
index 782cee62a4..2749b743eb 100644
--- a/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
+++ b/apps/desktop/src/renderer/__tests__/dialogueSidebarSection.test.ts
@@ -182,6 +182,24 @@ describe('Mixed main list (sidebar-redesign D 期)', () => {
);
});
+ // 2026-08-12 实机反馈:list 变体的分割线是「每行底线 + 列表首行顶线」,而混排把
+ // 每条散排对话各渲染成一个单条 SessionEntryList → 每个都自认首行,上一行底线与
+ // 本行顶线叠成两根横线。散排路径必须关掉顶线(底线已覆盖行间分割)。
+ it('does not double up dividers between standalone dialogues in list mode', () => {
+ const sessionEntryListSource = readFileSync(
+ resolve(__dirname, '..', 'features', 'cc-agent', 'sidebar', 'SessionEntryList.tsx'),
+ 'utf8',
+ );
+ expect(sessionEntryListSource).toContain('isFirst={showFirstDivider && index === 0}');
+ expect(projectsSectionSource).toContain('showFirstDivider={false}');
+ // 真正的列表首行(置顶段 / 项目内会话 / 自动化组)保持默认,不传该 prop。
+ const pinnedSectionSource = readFileSync(
+ resolve(__dirname, '..', 'features', 'cc-agent', 'sidebar', 'sections', 'PinnedSection.tsx'),
+ 'utf8',
+ );
+ expect(pinnedSectionSource).not.toContain('showFirstDivider');
+ });
+
it('allows the shared create route to send a standalone dialogue without picking a project', () => {
// 产品决策:新建入口、对话段 +、项目行内 + 都进同一个创建页;差异只在默认
// workingDir。workingDir 为空时直接创建 dialogue,不再强制弹项目 picker。
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionEntryList.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionEntryList.tsx
index 356a2d1170..277eb31a5d 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionEntryList.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionEntryList.tsx
@@ -9,7 +9,10 @@ import type {
AutomationSessionGroup,
SidebarSessionEntry,
} from '../lib/automationSidebarGrouping';
-import { getEntryActivityMs, groupAutomationSidebarEntries } from '../lib/automationSidebarGrouping';
+import {
+ getEntryActivityMs,
+ groupAutomationSidebarEntries,
+} from '../lib/automationSidebarGrouping';
import { getSessionListCollapseView } from '../lib/sessionListCollapse';
import { AutomationSessionGroupItem } from './AutomationSessionGroupItem';
import { SessionItem } from './SessionItem';
@@ -26,7 +29,10 @@ function entryIsActive(entry: SidebarSessionEntry, activeSessionId?: string): bo
return entry.group.sessions.some((s) => s.id === activeSessionId);
}
/** 条目是否需关注(group 命中其下任一会话)。 */
-function entryHasAttention(entry: SidebarSessionEntry, notifications: ReadonlySet<string>): boolean {
+function entryHasAttention(
+ entry: SidebarSessionEntry,
+ notifications: ReadonlySet<string>,
+): boolean {
if (entry.kind === 'session') return notifications.has(entry.session.id);
return entry.group.sessions.some((s) => notifications.has(s.id));
}
@@ -63,6 +69,13 @@ export interface SessionEntryListProps {
sectionCollapsed?: boolean;
/** 项目置顶到列表模式时,项目内会话复用满宽列表卡片;其它场景保持紧凑文字行。 */
sessionVariant?: 'text' | 'list';
+ /**
+ * list 变体的分割线规则是「每行画底线 + 列表首行补顶线」。混排主列表把**每条**
+ * 散排对话各渲染成一个独立的 SessionEntryList,每个都自认首行 → 上一行底线 +
+ * 本行顶线叠成两根(2026-08-12 实机反馈)。这种「本列表只是长列表中的一段」的
+ * 场景传 false 关掉顶线;真正的列表首行(置顶段 / 项目内会话)保持默认。
+ */
+ showFirstDivider?: boolean;
}
export interface SessionEntryRowsProps extends Omit<
@@ -90,6 +103,7 @@ export function SessionEntryRows({
matchMap,
sourceLabelMap,
sessionVariant = 'text',
+ showFirstDivider = true,
}: SessionEntryRowsProps) {
return (
<>
@@ -122,7 +136,7 @@ export function SessionEntryRows({
key={entry.session.id}
{...commonProps}
variant="list"
- isFirst={index === 0}
+ isFirst={showFirstDivider && index === 0}
hideBottomDivider={nextHighlighted}
/>
) : (
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
index 4e5935a274..53259d3620 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
@@ -31,7 +31,10 @@ const globalsSource = readFileSync(
describe('SessionCard review regressions', () => {
it('only draws the list top divider on the first overall entry', () => {
- expect(sessionEntryListSource).toContain('isFirst={index === 0}');
+ // 顶线只认「本列表的整体首行」,不因中间夹了非 session 条目就重画。
+ // 2026-08-12 起额外受 showFirstDivider 约束:混排主列表把每条散排对话各渲染成
+ // 一个单条列表,若都补顶线会与上一行的底线叠成两根横线,那条路径传 false。
+ expect(sessionEntryListSource).toContain('isFirst={showFirstDivider && index === 0}');
expect(sessionEntryListSource).not.toContain(
"isFirst={index === 0 || entries[index - 1]?.kind !== 'session'}",
);
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
index 369b16699e..1f525d89e3 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sections/ProjectsSection.tsx
@@ -514,6 +514,9 @@ export function ProjectsSection({
onScheduleAction={onScheduleAction}
sourceLabelMap={dialogueSourceLabelMap}
sessionVariant={mainSessionVariant}
+ // 混排下每条散排对话各是一个单条列表,若都补顶线,会与上一行的底线叠成
+ // 两根横线(2026-08-12 实机反馈)。底线已覆盖行间分割,这里只关顶线。
+ showFirstDivider={false}
/>
);
}