fix(web): the Chat / Terminal switch is off by default

Owner decision for 1.52.1: the chat view's switch must not appear for
every desktop user on every local Claude session. showChatViewSwitch now
shows it only when true (an absent key means hidden), on both the reader
(_chatViewSwitchShown) and the App Settings checkbox. The chat view
itself was already off by default; Alt+Shift+C still switches views with
the switch hidden. Docs and tests follow; the two default tests fail
with the old !== false reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-12-03 10:54:17 +01:00
1 parent 15ea44e5c1
commit 3994196341
6 files changed
+20 -18

No files matched your search

+6 -5
View File
@@ -279,7 +279,8 @@ describe('chat view module', () => {
const { win, app } = loadModule({ messages: [[{ role: 'user', text: 'Hi', turn: 1 }]] });
app.onChatViewActiveSession('s1');
expect(app.chatViewModeFor('s1')).toBe('terminal');
expect(app._chatView.toggle.hidden).toBe(false);
// The switch is off by default (no showChatViewSwitch on this device); its own tests are below.
expect(app._chatView.toggle.hidden).toBe(true);
expect(app._chatView.root.hidden).toBe(true);
app.setChatViewMode('s1', 'chat');
@@ -324,11 +325,11 @@ describe('chat view module', () => {
expect(init).toContain('this._chatViewPruneModes?.(new Set(data.sessions.map((s) => s.id)));');
});
it('shows the Chat / Terminal switch when the device has no showChatViewSwitch setting', () => {
it('hides the Chat / Terminal switch when the device has no showChatViewSwitch setting (off by default)', () => {
const { app } = loadModule();
app.loadAppSettingsFromStorage = () => ({});
app.onChatViewActiveSession('s1');
expect(app._chatView.toggle.hidden).toBe(false);
expect(app._chatView.toggle.hidden).toBe(true);
app.loadAppSettingsFromStorage = () => ({ showChatViewSwitch: true });
app._chatViewSync();
expect(app._chatView.toggle.hidden).toBe(false);
@@ -774,12 +775,12 @@ describe('chat view wiring', () => {
expect(schemas).not.toContain('chatViewDefault');
});
it('keeps showChatViewSwitch per device, out of the server PUT, and on when absent', () => {
it('keeps showChatViewSwitch per device, out of the server PUT, and off when absent', () => {
const settings = read('settings-ui.js');
expect(settings).toMatch(/'showEditHistory', 'chatViewDefault', 'showChatViewSwitch',/);
expect(settings).toContain('showChatViewSwitch: _scvs,');
expect(settings).toContain(
"document.getElementById('appSettingsShowChatViewSwitch').checked = settings.showChatViewSwitch !== false;"
"document.getElementById('appSettingsShowChatViewSwitch').checked = settings.showChatViewSwitch === true;"
);
const schemas = readFileSync(resolve(import.meta.dirname, '../src/web/schemas.ts'), 'utf8');
expect(schemas).not.toContain('showChatViewSwitch');