Skip to content

Commit

Permalink
fix(ai-help): don't allow empty questions (#10344)
Browse files Browse the repository at this point in the history
* fix(ai-help): don't allow empty questions

* add empty check to onKeyDown
  • Loading branch information
fiji-flo authored Jan 24, 2024
1 parent 4ac6fdf commit 6cd6d4a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/plus/ai-help/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function AIHelpUserQuestion({
className="ai-help-input-form"
onSubmit={(event) => {
event.preventDefault();
if (canEdit && question) {
if (canEdit && question?.trim()) {
gleanClick(`${AI_HELP}: edit submit`);
setEditing(false);
submit(question, message.chatId, message.parentId, message.messageId);
Expand All @@ -167,7 +167,7 @@ function AIHelpUserQuestion({
onKeyDown={(event) => {
if (event.key === "Enter" && !event.shiftKey) {
event.preventDefault();
if (canEdit && question) {
if (canEdit && question?.trim()) {
gleanClick(`${AI_HELP}: edit submit`);
setEditing(false);
submit(
Expand Down Expand Up @@ -205,7 +205,7 @@ function AIHelpUserQuestion({
icon="send"
buttonType="submit"
title="Submit question"
isDisabled={!question}
isDisabled={!question.trim()}
>
<span className="visually-hidden">Submit question</span>
</Button>
Expand Down Expand Up @@ -810,7 +810,7 @@ export function AIHelpInner() {
icon="send"
buttonType="submit"
title="Submit question"
isDisabled={!query}
isDisabled={!query.trim()}
>
<span className="visually-hidden">
Submit question
Expand Down

0 comments on commit 6cd6d4a

Please sign in to comment.