Skip to content

Commit cdd149a

Browse files
author
Himanshi Agrawal
committed
Bug10178 fix disable clear all history if there is no chat history
1 parent 92e45e3 commit cdd149a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

frontend/src/components/ChatHistory/ChatHistoryPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
4949
const [hideClearAllDialog, { toggle: toggleClearAllDialog }] = useBoolean(true)
5050
const [clearing, setClearing] = React.useState(false)
5151
const [clearingError, setClearingError] = React.useState(false)
52-
52+
const hasChatHistory = appStateContext?.state.chatHistory && appStateContext.state.chatHistory.length > 0;
5353
const clearAllDialogContentProps = {
5454
type: DialogType.close,
5555
title: !clearingError ? 'Are you sure you want to clear all chat history?' : 'Error deleting all of chat history',
@@ -67,7 +67,7 @@ export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
6767
}
6868

6969
const menuItems: IContextualMenuItem[] = [
70-
{ key: 'clearAll', text: 'Clear all chat history', iconProps: { iconName: 'Delete' } }
70+
{ key: 'clearAll', text: 'Clear all chat history',disabled: !hasChatHistory, iconProps: { iconName: 'Delete' }}
7171
]
7272

7373
const handleHistoryClick = () => {

0 commit comments

Comments
 (0)