Skip to content

Commit 1a2e752

Browse files
Merge pull request microsoft#11 from Roopan-Microsoft/Bug10178
'fix' : Clear All chat history button should be disable where there is No chat History
2 parents 92e45e3 + cdd149a commit 1a2e752

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)