From 621d551c4a0b7960586c7bdae0ac28aaa980c7e4 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Wed, 8 Nov 2023 17:33:26 +0530 Subject: [PATCH] fix: project select validation (#2723) --- web/components/issues/form.tsx | 6 +++++- web/components/issues/select/project.tsx | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/components/issues/form.tsx b/web/components/issues/form.tsx index b54ce1121..2c9fb4eab 100644 --- a/web/components/issues/form.tsx +++ b/web/components/issues/form.tsx @@ -272,9 +272,13 @@ export const IssueForm: FC = observer((props) => { ( + rules={{ + required: true, + }} + render={({ field: { value, onChange }, fieldState: { error } }) => ( { onChange(val); setActiveProject(val); diff --git a/web/components/issues/select/project.tsx b/web/components/issues/select/project.tsx index 08f245b14..ad55471ce 100644 --- a/web/components/issues/select/project.tsx +++ b/web/components/issues/select/project.tsx @@ -1,6 +1,7 @@ import React, { useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; +import type { FieldError } from "react-hook-form"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // popper js @@ -15,6 +16,7 @@ import { Check, Clipboard, Search } from "lucide-react"; export interface IssueProjectSelectProps { value: string; onChange: (value: string) => void; + error?: FieldError; } export const IssueProjectSelect: React.FC = observer((props) => {