Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(ui): die letzten Chats bleiben stehen, bis die erste Nachricht raus ist

purple98854371ea6b
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 3f69f32a..566c7d96 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -90,6 +90,17 @@ export function ChatView() {
const refreshDevices = useRemoteStore((s) => s.refreshDevices)
const activeConv = conversations.find((c) => c.id === activeConversationId)
const isRemoteChat = activeConv?.mode === 'remote'
+ // A chat that is open but has nothing in it yet. Counted the way MessageList
+ // counts: the system prompt and hidden bookkeeping are not something the user
+ // has said. Screen check on the bundle (David, 2026-09-02): after New Chat the
+ // main area went blank, because the recent list only stood on the no-chat
+ // screen. While the panel is collapsed and the chat is still empty, the list
+ // belongs above the composer instead.
+ const activeConvIsEmpty =
+ !!activeConv &&
+ (activeConv.mode ?? 'lu') === 'lu' &&
+ activeConv.messages.filter((m) => m.role !== 'system' && !m.hidden).length === 0
+ const showRecentsAboveComposer = !sidebarOpen && activeConvIsEmpty
const isThisRemoteActive = isRemoteChat && remoteEnabled && dispatchedConversationId === activeConversationId
const isThisRemoteStopped = isRemoteChat && !isThisRemoteActive
const mobileConnectedCount = connectedDevices.length
@@ -263,16 +274,25 @@ export function ChatView() {
by default so it costs one line above the transcript. */}
<PlanBar />
- <MessageList
- isGenerating={isGenerating}
- isThisChatGenerating={activeGenerating}
- isLoadingModel={isLoadingModel}
- onRegenerate={regenerateMessage}
- onEdit={editAndResend}
- pendingApprovalId={pendingApproval?.id ?? null}
- onApprove={approveToolCall}
- onReject={rejectToolCall}
- />
+ {showRecentsAboveComposer ? (
+ // Same flex slot the transcript would take, so the composer
+ // stays where it is at the bottom of the view.
+ <div className="flex-1 flex flex-col items-center justify-center overflow-y-auto scrollbar-thin py-4">
+ <img src="/LU-monogram-bw.png" alt="" width={46} height={46} className="dark:invert-0 invert opacity-20 mb-5" />
+ <RecentChats />
+ </div>
+ ) : (
+ <MessageList
+ isGenerating={isGenerating}
+ isThisChatGenerating={activeGenerating}
+ isLoadingModel={isLoadingModel}
+ onRegenerate={regenerateMessage}
+ onEdit={editAndResend}
+ pendingApprovalId={pendingApproval?.id ?? null}
+ onApprove={approveToolCall}
+ onReject={rejectToolCall}
+ />
+ )}
{/* Remote session banners */}
{isThisRemoteActive && (
diff --git a/src/components/chat/RecentChats.tsx b/src/components/chat/RecentChats.tsx
index 9a895e64..faeb1720 100644
--- a/src/components/chat/RecentChats.tsx
+++ b/src/components/chat/RecentChats.tsx
@@ -19,11 +19,15 @@ const MAX_ROWS = 8
export function RecentChats() {
const conversations = useChatStore((s) => s.conversations)
+ const activeConversationId = useChatStore((s) => s.activeConversationId)
const setActiveConversation = useChatStore((s) => s.setActiveConversation)
const setView = useUIStore((s) => s.setView)
const setChatMode = useCodexStore((s) => s.setChatMode)
const recents = conversations
+ // The chat you are already looking at is not a place to go back to. On the
+ // no-chat screen nothing is active, so nothing is dropped there.
+ .filter((c) => c.id !== activeConversationId)
.filter((c) => (c.mode ?? 'lu') === 'lu')
.sort((a, b) => b.updatedAt - a.updatedAt)
.slice(0, MAX_ROWS)
diff --git a/src/components/chat/__tests__/home-recent-chats.test.ts b/src/components/chat/__tests__/home-recent-chats.test.ts
index 6f0c6d49..e5d19eed 100644
--- a/src/components/chat/__tests__/home-recent-chats.test.ts
+++ b/src/components/chat/__tests__/home-recent-chats.test.ts
@@ -8,8 +8,13 @@
*
* The list itself is covered in
* src/components/layout/__tests__/sidebar-collapse-parity.test.ts. This file
- * only holds the one rule that connects it to the panel: it stands in the main
- * area while the panel is collapsed, and nowhere while the panel is open.
+ * holds the rule that connects it to the panel: it stands in the main area
+ * while the panel is collapsed, and nowhere while the panel is open.
+ *
+ * Widened after the screen check on the bundle (David, 2026-09-02): the list
+ * only stood on the no-chat screen, so New Chat led to a blank main area. It
+ * has to stand above the composer for as long as the open chat is still empty,
+ * and go the moment the first message is sent.
*
* Run: npx vitest run src/components/chat/__tests__/home-recent-chats.test.ts
*/
@@ -20,7 +25,7 @@ import { ChatView } from '../ChatView'
import { useUIStore } from '../../../stores/uiStore'
import { useChatStore } from '../../../stores/chatStore'
import { useCompareStore } from '../../../stores/compareStore'
-import type { Conversation } from '../../../types/chat'
+import type { Conversation, Message } from '../../../types/chat'
// The composer's dictation button reaches for the microphone and the Tauri
// bridge on mount. Neither exists here and neither is what this file is about.
@@ -32,6 +37,10 @@ const conv = (id: string, title: string, updatedAt: number): Conversation => ({
createdAt: updatedAt, updatedAt,
})
+const said = (text: string): Message => ({
+ id: `m-${text}`, role: 'user', content: text, timestamp: NOW,
+})
+
beforeEach(() => {
useUIStore.setState({ currentView: 'chat', sidebarOpen: false })
useCompareStore.setState({ isComparing: false })
@@ -66,10 +75,74 @@ describe('the latest chats on the home screen', () => {
expect(useChatStore.getState().activeConversationId).toBe('a')
})
- it('COUNTER-TEST: an open conversation replaces the home screen entirely', () => {
- // The list belongs to the empty state. Once a chat is open the transcript
- // owns the area, collapsed panel or not.
- useChatStore.setState({ activeConversationId: 'a' })
+})
+
+describe('an open but still empty chat', () => {
+ beforeEach(() => {
+ useChatStore.setState({
+ conversations: [conv('a', 'Yesterdays thread', NOW - 3600_000), conv('fresh', 'New Chat', NOW)],
+ activeConversationId: 'fresh',
+ })
+ })
+
+ it('collapsed panel: the list stands above the composer', () => {
+ render(createElement(ChatView))
+ const list = screen.getByTestId('home-recent-chats')
+ expect(list.textContent).toContain('Yesterdays thread')
+ // The composer is still there, at the bottom, and the list did not replace it.
+ expect(document.querySelector('textarea')).toBeTruthy()
+ })
+
+ it('the chat you are in is not offered as somewhere to go', () => {
+ render(createElement(ChatView))
+ expect(screen.getByTestId('home-recent-chats').textContent).not.toContain('New Chat')
+ })
+
+ it('the first message clears it', () => {
+ useChatStore.setState({
+ conversations: [
+ conv('a', 'Yesterdays thread', NOW - 3600_000),
+ { ...conv('fresh', 'New Chat', NOW), messages: [said('hello')] },
+ ],
+ activeConversationId: 'fresh',
+ })
+ render(createElement(ChatView))
+ expect(screen.queryByTestId('home-recent-chats')).toBeNull()
+ })
+
+ it('COUNTER-TEST: expanded panel, no list even in an empty chat', () => {
+ useUIStore.setState({ sidebarOpen: true })
+ render(createElement(ChatView))
+ expect(screen.queryByTestId('home-recent-chats')).toBeNull()
+ })
+
+ it('COUNTER-TEST: a system prompt is not something the user said', () => {
+ // The count has to match what MessageList shows, or a chat with a persona
+ // would come up looking used before anybody typed anything.
+ useChatStore.setState({
+ conversations: [
+ conv('a', 'Yesterdays thread', NOW - 3600_000),
+ {
+ ...conv('fresh', 'New Chat', NOW),
+ messages: [{ id: 'sys', role: 'system', content: 'You are blunt.', timestamp: NOW }],
+ },
+ ],
+ activeConversationId: 'fresh',
+ })
+ render(createElement(ChatView))
+ expect(screen.getByTestId('home-recent-chats')).toBeTruthy()
+ })
+
+ it('COUNTER-TEST: a remote session keeps its own screen', () => {
+ // Remote has its own banners and its own state under the transcript. A
+ // recent-chats list on top of that is noise, not a launcher.
+ useChatStore.setState({
+ conversations: [
+ conv('a', 'Yesterdays thread', NOW - 3600_000),
+ { ...conv('fresh', 'Dispatched', NOW), mode: 'remote' },
+ ],
+ activeConversationId: 'fresh',
+ })
render(createElement(ChatView))
expect(screen.queryByTestId('home-recent-chats')).toBeNull()
})