fix: sync context panel iframe themes

Keeps embedded sessions aligned with parent theme
Prevents iframe reloads on theme changes
Supports theme hotkeys from focused iframes
This commit is contained in:
Bohdan Triapitsyn
2026-06-16 23:33:29 +03:00
parent 91e8e94961
commit 0fef61e25f
12 changed files with 484 additions and 118 deletions
@@ -0,0 +1,30 @@
import { beforeEach, describe, expect, test } from 'bun:test';
import { useUIStore } from './useUIStore';
beforeEach(() => {
useUIStore.setState({ contextPanelByDirectory: {} });
});
describe('useUIStore context panel tabs', () => {
test('updates readOnly when an existing chat tab is reopened', () => {
const directory = '/repo';
useUIStore.getState().openContextPanelTab(directory, {
mode: 'chat',
dedupeKey: 'session:ses_1',
label: 'Session',
readOnly: true,
});
useUIStore.getState().openContextPanelTab(directory, {
mode: 'chat',
dedupeKey: 'session:ses_1',
label: 'Session',
readOnly: false,
});
const tabs = useUIStore.getState().contextPanelByDirectory[directory]?.tabs ?? [];
expect(tabs).toHaveLength(1);
expect(tabs[0]?.readOnly).toBe(false);
});
});