Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(sidebar): 同模式切主题时重读 PR icon 表面
Dash0a270ed06acb
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsxindex 5e1a3ef26e..85939fa37b 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/SessionInfoMeta.tsx@@ -153,7 +153,9 @@ function PrNumberPiece({ prRef, isActive }: { prRef: SessionPrRef; isActive?: boconst observer = new MutationObserver(read);observer.observe(document.documentElement, {attributes: true,- attributeFilter: ['class', 'style'],+ // data-theme:同模式切社区/导入主题时 class 与 colorScheme 都不动,+ // applyTheme 只改 dataset.theme(2026-08-17 review P1)。+ attributeFilter: ['class', 'style', 'data-theme'],});return () => observer.disconnect();}, [isActive, themeIsDark]);diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.tsindex fd51cf7c98..773cd6ace8 100644--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.ts+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionInfoMetaPr.test.ts@@ -1,7 +1,7 @@// @vitest-environment jsdomimport { createElement } from 'react';-import { cleanup, render, screen } from '@testing-library/react';+import { cleanup, render, screen, waitFor } from '@testing-library/react';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { SessionInfoMeta } from '../SessionInfoMeta';@@ -37,6 +37,9 @@ afterEach(() => {cleanup();status = undefined;document.documentElement.classList.remove('dark');+ delete document.documentElement.dataset.theme;+ document.documentElement.style.removeProperty('--sidebar');+ document.documentElement.style.removeProperty('--sidebar-item-active');});beforeEach(() => {@@ -121,4 +124,39 @@ describe('SessionInfoMeta PR 徽标', () => {expect(container.querySelector('[aria-hidden].rounded-full')).toBeNull();});++ it('同模式切主题只改 data-theme 时重读选中表面', async () => {+ status = {+ ok: true,+ owner: prRef.owner,+ repo: prRef.repo,+ prNumber: prRef.prNumber,+ status: 'open',+ title: 'demo',+ htmlUrl: prRef.url,+ branch: 'feat/demo',+ unresolvedCount: 0,+ };+ document.documentElement.style.setProperty('--sidebar-item-active', '0.0 0.0% 93.3%');++ const { container } = render(+ createElement(SessionInfoMeta, {+ pieces: [{ key: 'pr', text: '' }],+ prRef,+ isActive: true,+ }),+ );+ expect((container.querySelector('svg') as SVGElement).style.color).toBe(+ 'var(--pr-open-on-light)',+ );++ document.documentElement.style.setProperty('--sidebar-item-active', '0.0 0.0% 18.0%');+ document.documentElement.dataset.theme = 'monokai-pro';++ await waitFor(() => {+ expect((container.querySelector('svg') as SVGElement).style.color).toBe(+ 'var(--pr-open-on-dark)',+ );+ });+ });});