Skip to content

Commit e31c8ed

Browse files
committed
Merge branch 'feat/usage-widget'
# Conflicts: # src/renderer/features/details-sidebar/atoms/index.ts
2 parents 45e9233 + f9f51c8 commit e31c8ed

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/renderer/features/agents/main/active-chat.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4539,10 +4539,13 @@ export function ChatView({
45394539
})
45404540
}, [chatId, setUnseenChanges])
45414541

4542-
// Get sub-chat state from store (using getState() to avoid re-renders on state changes)
4543-
const activeSubChatId = useAgentSubChatStore.getState().activeSubChatId
4544-
const openSubChatIds = useAgentSubChatStore.getState().openSubChatIds
4545-
const pinnedSubChatIds = useAgentSubChatStore.getState().pinnedSubChatIds
4542+
// Get sub-chat state from store (reactive selectors to re-render when store changes)
4543+
// IMPORTANT: Using reactive selectors here is critical for new chats where activeSubChatId
4544+
// starts as null and is set after the store initializes from the useEffect below.
4545+
// Using getState() would cause the component to not re-render, showing a disabled input.
4546+
const activeSubChatId = useAgentSubChatStore((state) => state.activeSubChatId)
4547+
const openSubChatIds = useAgentSubChatStore((state) => state.openSubChatIds)
4548+
const pinnedSubChatIds = useAgentSubChatStore((state) => state.pinnedSubChatIds)
45464549

45474550
// Clear sub-chat "unseen changes" indicator when sub-chat becomes active
45484551
useEffect(() => {
@@ -4556,7 +4559,7 @@ export function ChatView({
45564559
return prev
45574560
})
45584561
}, [activeSubChatId, setSubChatUnseenChanges])
4559-
const allSubChats = useAgentSubChatStore.getState().allSubChats
4562+
const allSubChats = useAgentSubChatStore((state) => state.allSubChats)
45604563

45614564
// tRPC utils for optimistic cache updates
45624565
const utils = api.useUtils()

src/renderer/features/details-sidebar/atoms/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Box, FileText, Terminal, FileDiff, ListTodo, Gauge } from "lucide-react
88
// Widget System Types & Registry
99
// ============================================================================
1010

11-
export type WidgetId = "info" | "todo" | "plan" | "terminal" | "diff" | "usage"
11+
export type WidgetId = "info" | "usage" | "todo" | "plan" | "terminal" | "diff"
1212

1313
export interface WidgetConfig {
1414
id: WidgetId

0 commit comments

Comments
 (0)