actually give existing users the live panel
The previous commit added it to defaultLayout, which anyone who has ever opened /chat never sees: useDashboardState seeds its default only when the key is ABSENT, so a stored layout keeps the shape it had when it was first written. appTypes/normalizeLayout does not cover this — it repairs which app a panel runs, never the tree — so the change was visible only on a fresh account. It was shipped with a note to reset the layout by hand, which is not a fix. The screen now replaces a layout with no chat-live panel. Replacing outright is safe here specifically because the screen is locked: the structure is dictated by code, and the only user contribution is column sizes. Terminates because the replacement contains the panel it tests for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { useClient } from 'hooks/useClient';
|
||||
import { errorText } from 'helpers/error-text';
|
||||
import { useDashboardState } from 'state/useDashboardState';
|
||||
import type { ClaudeSessionDetail } from 'state/useClaudeSessions';
|
||||
import { defaultLayout } from './defaultLayout';
|
||||
import { defaultLayout, hasAppType } from './defaultLayout';
|
||||
|
||||
// How many messages to render on first open (anchored to the bottom); scroll-up pages older ones in.
|
||||
const CHAT_TAIL = 20;
|
||||
@@ -32,6 +32,22 @@ export const SessionListPage = ({ isNew }: SessionListPageProps) => {
|
||||
const navigate = useNavigate();
|
||||
const mobilePanelId = isMobile && (sessionId || isNew) ? 'chat-detail' : undefined;
|
||||
|
||||
// Adopt a structural change to this screen's layout.
|
||||
//
|
||||
// `useDashboardState` seeds its default ONLY when the key is absent, so anyone who has ever opened
|
||||
// /chat keeps the shape it had then — for good. `appTypes`/`normalizeLayout` does not help: it repairs
|
||||
// which app a panel runs, never the tree, so adding the Live panel above the list would have been
|
||||
// invisible to every existing user and visible only on a fresh account.
|
||||
//
|
||||
// Replacing outright is safe *here* specifically because the screen is `locked`: its structure is
|
||||
// dictated by code and the only thing a user can have contributed is the column sizes, which is a
|
||||
// cheap thing to lose once. Terminates because the replacement contains the panel it tests for.
|
||||
useEffect(() => {
|
||||
if (!workspace.isLoaded) return;
|
||||
if (hasAppType(workspace.value, 'chat-live')) return;
|
||||
workspace.setValue(defaultLayout);
|
||||
}, [workspace.isLoaded, workspace.value, workspace.setValue]);
|
||||
|
||||
// Retire a legacy `?cwd=`. Nothing reads it any more and nothing writes it, but a refresh re-requests
|
||||
// the address bar verbatim — so one left over from before the path-based groups sits there forever,
|
||||
// looking like it means something. On a bare /chat it still says which group you wanted, so upgrade
|
||||
|
||||
Reference in New Issue
Block a user