Skip to content

Commit ee9fb41

Browse files
fix: prevent new conversation action when no messages are present
2 parents e6ce244 + e2b4d75 commit ee9fb41

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
@@ -336,15 +336,15 @@ export function ChatHistory({
336336
</Link>
337337
)}
338338
<Link
339-
onClick={isGenerating ? undefined : onNewConversation}
339+
onClick={(isGenerating || currentMessages.length === 0) ? undefined : onNewConversation}
340340
style={{
341341
display: 'flex',
342342
alignItems: 'center',
343343
gap: '8px',
344344
fontSize: '13px',
345-
color: isGenerating ? tokens.colorNeutralForegroundDisabled : tokens.colorNeutralForeground1,
346-
cursor: isGenerating ? 'not-allowed' : 'pointer',
347-
pointerEvents: isGenerating ? 'none' : 'auto',
345+
color: (isGenerating || currentMessages.length === 0) ? tokens.colorNeutralForegroundDisabled : tokens.colorNeutralForeground1,
346+
cursor: (isGenerating || currentMessages.length === 0) ? 'not-allowed' : 'pointer',
347+
pointerEvents: (isGenerating || currentMessages.length === 0) ? 'none' : 'auto',
348348
}}
349349
>
350350
<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)