Skip to content

Commit 123f9bc

Browse files
Merge pull request #58 from microsoft/PSL-7473
fix: Disabling the clear all history button when loading
2 parents 6a0674c + f6bb48e commit 123f9bc

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ClientAdvisor/App/frontend/src/components/ChatHistory/ChatHistoryPanel.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import ChatHistoryList from './ChatHistoryList'
2626

2727
import styles from './ChatHistoryPanel.module.css'
2828

29-
interface ChatHistoryPanelProps {}
29+
interface ChatHistoryPanelProps {
30+
isLoading: boolean
31+
}
3032

3133
export enum ChatHistoryPanelTabs {
3234
History = 'History'
@@ -44,6 +46,7 @@ const commandBarStyle: ICommandBarStyles = {
4446
const commandBarButtonStyle: Partial<IStackStyles> = { root: { height: '50px' } }
4547

4648
export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
49+
const { isLoading} = _props
4750
const appStateContext = useContext(AppStateContext)
4851
const [showContextualMenu, setShowContextualMenu] = React.useState(false)
4952
const [hideClearAllDialog, { toggle: toggleClearAllDialog }] = useBoolean(true)
@@ -67,7 +70,7 @@ export function ChatHistoryPanel(_props: ChatHistoryPanelProps) {
6770
}
6871

6972
const menuItems: IContextualMenuItem[] = [
70-
{ key: 'clearAll', text: 'Clear all chat history',disabled: !hasChatHistory, iconProps: { iconName: 'Delete' }}
73+
{ key: 'clearAll', text: 'Clear all chat history',disabled: (!hasChatHistory || isLoading), iconProps: { iconName: 'Delete' }}
7174
]
7275

7376
const handleHistoryClick = () => {

ClientAdvisor/App/frontend/src/pages/chat/Chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ const Chat = () => {
969969
</Stack.Item>
970970
)}
971971
{appStateContext?.state.isChatHistoryOpen &&
972-
appStateContext?.state.isCosmosDBAvailable?.status !== CosmosDBStatus.NotConfigured && <ChatHistoryPanel />}
972+
appStateContext?.state.isCosmosDBAvailable?.status !== CosmosDBStatus.NotConfigured && <ChatHistoryPanel isLoading={isLoading} />}
973973
</Stack>
974974
)}
975975
</div>

0 commit comments

Comments
 (0)