Skip to content

Commit

Permalink
[WEB-496] improvement: disable submit button when there is no text in…
Browse files Browse the repository at this point in the history
… comment box. (#3754)
  • Loading branch information
prateekshourya29 authored Feb 22, 2024
1 parent d73cd2e commit e924170
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export const IssueCommentCreate: FC<TIssueCommentCreate> = (props) => {
control,
formState: { isSubmitting },
reset,
} = useForm<Partial<TIssueComment>>({ defaultValues: { comment_html: "<p></p>" } });
watch,
} = useForm<Partial<TIssueComment>>({ defaultValues: { comment_html: "" } });

const onSubmit = async (formData: Partial<TIssueComment>) => {
await activityOperations.createComment(formData).finally(() => {
Expand Down Expand Up @@ -88,7 +89,7 @@ export const IssueCommentCreate: FC<TIssueCommentCreate> = (props) => {
deleteFile={fileService.getDeleteImageFunction(workspaceId)}
restoreFile={fileService.getRestoreImageFunction(workspaceId)}
ref={editorRef}
value={!value ? "<p></p>" : value}
value={value ?? ""}
customClassName="p-2"
editorContentCustomClassNames="min-h-[35px]"
debouncedUpdatesEnabled={false}
Expand All @@ -104,7 +105,7 @@ export const IssueCommentCreate: FC<TIssueCommentCreate> = (props) => {
}
submitButton={
<Button
disabled={isSubmitting}
disabled={isSubmitting || watch("comment_html") === ""}
variant="primary"
type="submit"
className="!px-2.5 !py-1.5 !text-xs"
Expand Down

0 comments on commit e924170

Please sign in to comment.