diff --git a/apps/app/components/issues/description-form.tsx b/apps/app/components/issues/description-form.tsx index 0770834fa..e81c8c1b3 100644 --- a/apps/app/components/issues/description-form.tsx +++ b/apps/app/components/issues/description-form.tsx @@ -96,13 +96,7 @@ export const IssueDescriptionForm: FC = ({ setCharacterLimit(false); setIsSubmitting(true); - handleSubmit(handleDescriptionFormSubmit)() - .then(() => { - setIsSubmitting(false); - }) - .catch(() => { - setIsSubmitting(false); - }); + handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting(false)); }} required={true} className="min-h-10 block w-full resize-none overflow-hidden rounded border-none bg-transparent px-3 py-2 text-xl outline-none ring-0 focus:ring-1 focus:ring-custom-primary" @@ -110,7 +104,7 @@ export const IssueDescriptionForm: FC = ({ disabled={!isAllowed} /> {characterLimit && ( -
+
255 ? "text-red-500" : "" @@ -123,52 +117,47 @@ export const IssueDescriptionForm: FC = ({ )}
{errors.name ? errors.name.message : null} - { - if (!value && !watch("description_html")) return <>; +
+ { + if (!value && !watch("description_html")) return <>; - return ( - { - setShowAlert(true); - setValue("description", jsonValue); - }} - onHTMLChange={(htmlValue) => { - setShowAlert(true); - setValue("description_html", htmlValue); - }} - onBlur={() => { - setIsSubmitting(true); - handleSubmit(handleDescriptionFormSubmit)() - .then(() => { - setIsSubmitting(false); - setShowAlert(false); - }) - .catch(() => { - setIsSubmitting(false); - }); - }} - placeholder="Description" - editable={isAllowed} - /> - ); - }} - /> -
- Saving... + return ( + { + setShowAlert(true); + setValue("description", jsonValue); + }} + onHTMLChange={(htmlValue) => { + setShowAlert(true); + setValue("description_html", htmlValue); + }} + onBlur={() => { + setIsSubmitting(true); + handleSubmit(handleDescriptionFormSubmit)() + .then(() => setShowAlert(false)) + .finally(() => setIsSubmitting(false)); + }} + placeholder="Description" + editable={isAllowed} + /> + ); + }} + /> + {isSubmitting && ( +
+ Saving... +
+ )}
); diff --git a/apps/app/components/issues/form.tsx b/apps/app/components/issues/form.tsx index 2a17a07a8..8469819e8 100644 --- a/apps/app/components/issues/form.tsx +++ b/apps/app/components/issues/form.tsx @@ -261,8 +261,10 @@ export const IssueForm: FC = ({ render={({ field: { value, onChange } }) => ( { + onChange(val); + setActiveProject(val); + }} /> )} /> diff --git a/apps/app/components/issues/modal.tsx b/apps/app/components/issues/modal.tsx index 09c4dbfe0..8ea57a439 100644 --- a/apps/app/components/issues/modal.tsx +++ b/apps/app/components/issues/modal.tsx @@ -95,9 +95,9 @@ export const CreateUpdateIssueModal: React.FC = ({ }; useEffect(() => { - if (projects && projects.length > 0) + if (projects && projects.length > 0 && !activeProject) setActiveProject(projects?.find((p) => p.id === projectId)?.id ?? projects?.[0].id ?? null); - }, [projectId, projects]); + }, [activeProject, projectId, projects]); useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { diff --git a/apps/app/components/issues/select/project.tsx b/apps/app/components/issues/select/project.tsx index 39fd12491..5d1c964e1 100644 --- a/apps/app/components/issues/select/project.tsx +++ b/apps/app/components/issues/select/project.tsx @@ -8,14 +8,9 @@ import { ClipboardDocumentListIcon } from "@heroicons/react/24/outline"; export interface IssueProjectSelectProps { value: string; onChange: (value: string) => void; - setActiveProject: React.Dispatch>; } -export const IssueProjectSelect: React.FC = ({ - value, - onChange, - setActiveProject, -}) => { +export const IssueProjectSelect: React.FC = ({ value, onChange }) => { const { projects } = useProjects(); return ( @@ -29,10 +24,7 @@ export const IssueProjectSelect: React.FC = ({ } - onChange={(val: string) => { - onChange(val); - setActiveProject(val); - }} + onChange={(val: string) => onChange(val)} noChevron > {projects ? (