Skip to content

Commit ec1dc3d

Browse files
authored
fix: clear chat preview when chat is deleted (#247)
1 parent 30ae0dd commit ec1dc3d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/components/history/command-history.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,15 @@ export function CommandHistory({
411411
async (id: string) => {
412412
setDeletingId(null)
413413
await onConfirmDelete(id)
414+
415+
// Clear preview and selection if the deleted chat was being previewed
416+
if (hoveredChatId === id || selectedChatId === id) {
417+
setHoveredChatId(null)
418+
setSelectedChatId(null)
419+
clearPreview()
420+
}
414421
},
415-
[onConfirmDelete]
422+
[onConfirmDelete, hoveredChatId, selectedChatId, clearPreview]
416423
)
417424

418425
const handleCancelDelete = useCallback(() => {

0 commit comments

Comments
 (0)