Skip to content

Commit e2b4d75

Browse files
fix: prevent new conversation action when no messages are present
1 parent 5953bca commit e2b4d75

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

content-gen/src/app/frontend/src/components/ChatHistory.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,15 @@ export function ChatHistory({
279279
</Link>
280280
)}
281281
<Link
282-
onClick={isGenerating ? undefined : onNewConversation}
282+
onClick={(isGenerating || currentMessages.length === 0) ? undefined : onNewConversation}
283283
style={{
284284
display: 'flex',
285285
alignItems: 'center',
286286
gap: '8px',
287287
fontSize: '13px',
288-
color: isGenerating ? tokens.colorNeutralForegroundDisabled : tokens.colorNeutralForeground1,
289-
cursor: isGenerating ? 'not-allowed' : 'pointer',
290-
pointerEvents: isGenerating ? 'none' : 'auto',
288+
color: (isGenerating || currentMessages.length === 0) ? tokens.colorNeutralForegroundDisabled : tokens.colorNeutralForeground1,
289+
cursor: (isGenerating || currentMessages.length === 0) ? 'not-allowed' : 'pointer',
290+
pointerEvents: (isGenerating || currentMessages.length === 0) ? 'none' : 'auto',
291291
}}
292292
>
293293
<Compose20Regular />

content-gen/src/app/frontend/src/components/ChatPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export function ChatPanel({
286286
icon={<Add20Regular />}
287287
size="small"
288288
onClick={onNewConversation}
289-
disabled={isLoading}
289+
disabled={isLoading || messages.length === 0}
290290
style={{
291291
minWidth: '32px',
292292
height: '32px',

0 commit comments

Comments
 (0)