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): 筛选各维度选中后不再收起整理菜单

Dash29bd514cd74a
diff --git a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
index d99940e951..cec4a6925a 100644
--- a/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
+++ b/apps/desktop/src/renderer/__tests__/machineSwitcherMenu.test.ts
@@ -181,6 +181,28 @@ describe('远程机器切换入口并入 SidebarTopNav(置顶段上方,固定不
expect(sidebarUpperSource).toContain('contextMenuPos={organizeMenuPos}');
});
+ // 2026-08-12 用户裁决:筛选各维度选中后菜单不关闭(常要连调几项);排序与显示
+ // 模式仍选完即关(一次一个决定)。
+ it('筛选维度选中后保持菜单打开,排序 / 显示模式仍选完即关', () => {
+ const filterSource = read('features', 'cc-agent', 'sidebar', 'SidebarFilterPopover.tsx');
+ // keepOpen 走 onSelect 的 preventDefault(Radix 据此不关闭菜单)。
+ expect(filterSource).toContain('keepOpen = false');
+ expect(filterSource).toContain('if (keepOpen) event.preventDefault();');
+ // 三个筛选维度都传 keepOpen。
+ expect(filterSource).toMatch(/onSelect=\{\(\) => setStatus\(option\.value\)\}\s*\n\s*keepOpen/);
+ expect(filterSource).toMatch(/onSelect=\{\(\) => setVendor\(option\.value\)\}\s*\n\s*keepOpen/);
+ expect(filterSource).toMatch(
+ /onSelect=\{\(\) => setLastActivity\(option\.value\)\}\s*\n\s*keepOpen/,
+ );
+ // 排序 / 显示模式不传(选完即关)。
+ expect(filterSource).not.toMatch(
+ /onSelect=\{\(\) => setSortBy\(option\.value\)\}\s*\n\s*keepOpen/,
+ );
+ expect(filterSource).not.toMatch(
+ /onSelect=\{\(\) => setMainViewMode\(option\.value\)\}\s*\n\s*keepOpen/,
+ );
+ });
+
// 2026-08-12 用户裁决:任务信息行的当前选中项用图标表示,不再罗列短词。
it('任务信息摘要用图标串,筛选各维度行也有图标', () => {
const filterSource = read('features', 'cc-agent', 'sidebar', 'SidebarFilterPopover.tsx');
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
index fe68f10796..248aea8475 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SidebarFilterPopover.tsx
@@ -227,14 +227,28 @@ function SelectMenuItem({
selected,
onSelect,
Icon,
+ keepOpen = false,
}: {
label: string;
selected: boolean;
onSelect: () => void;
Icon?: LucideIcon;
+ /**
+ * 选中后保持菜单打开(2026-08-12 用户裁决)。给筛选的各维度用:筛选常要连着
+ * 调好几项(状态 + Agent + 最近活跃),每选一次就整棵菜单收掉、得从段头重新点开
+ * 再逐级展开,很难用。项目多选那段本就是这个行为,这里把三个单选维度对齐。
+ * 排序与显示模式仍是选完即关——它们是「一次一个决定」,选完就该看列表效果。
+ */
+ keepOpen?: boolean;
}) {
return (
- <DropdownMenuItem onSelect={onSelect} className={MENU_ITEM_CLASS}>
+ <DropdownMenuItem
+ onSelect={(event) => {
+ if (keepOpen) event.preventDefault();
+ onSelect();
+ }}
+ className={MENU_ITEM_CLASS}
+ >
<MenuItemIcon Icon={Icon} />
<span className="truncate">{label}</span>
{selected && (
@@ -484,6 +498,7 @@ export function SidebarFilterPopover({
label={t(option.labelKey)}
selected={status === option.value}
onSelect={() => setStatus(option.value)}
+ keepOpen
/>
))}
</MenuSubRow>
@@ -562,6 +577,7 @@ export function SidebarFilterPopover({
label={t(option.labelKey)}
selected={vendor === option.value}
onSelect={() => setVendor(option.value)}
+ keepOpen
/>
))}
</MenuSubRow>
@@ -577,6 +593,7 @@ export function SidebarFilterPopover({
label={t(option.labelKey)}
selected={lastActivity === option.value}
onSelect={() => setLastActivity(option.value)}
+ keepOpen
/>
))}
</MenuSubRow>