fix: disable Delete button for main session instead of hiding

- Add isMainSession prop to ChatProps
- Show Delete button for all sessions but disable for main
- Add tooltip explaining why main session cannot be deleted
This commit is contained in:
Clawdbot 2026-01-28 17:04:12 +01:00
parent 0831ee3865
commit b57d85264c
2 changed files with 7 additions and 7 deletions

View File

@ -497,13 +497,12 @@ export function renderApp(state: AppViewState) {
onSplitRatioChange: (ratio: number) => state.handleSplitRatioChange(ratio),
assistantName: state.assistantName,
assistantAvatar: state.assistantAvatar,
// Delete session (hidden for main session)
// Delete session (disabled for main session)
showDeleteConfirm: state.chatDeleteConfirm,
onDeleteClick:
isMainSession:
state.sessionKey === "main" ||
parseAgentSessionKey(state.sessionKey)?.rest === "main"
? undefined
: () => (state.chatDeleteConfirm = true),
parseAgentSessionKey(state.sessionKey)?.rest === "main",
onDeleteClick: () => (state.chatDeleteConfirm = true),
onDeleteConfirm: async () => {
state.chatDeleteConfirm = false;
const { deleteSession } = await import("./controllers/sessions");

View File

@ -70,6 +70,7 @@ export type ChatProps = {
onChatScroll?: (event: Event) => void;
// Delete session
showDeleteConfirm?: boolean;
isMainSession?: boolean;
onDeleteClick?: () => void;
onDeleteConfirm?: () => void;
onDeleteCancel?: () => void;
@ -407,9 +408,9 @@ export function renderChat(props: ChatProps) {
? html`
<button
class="btn danger"
?disabled=${!props.connected || isBusy}
?disabled=${!props.connected || isBusy || props.isMainSession}
@click=${props.onDeleteClick}
title="Delete this session"
title=${props.isMainSession ? "Cannot delete main session" : "Delete this session"}
>
Delete
</button>