fix: project select validation (#2723)

This commit is contained in:
Dakshesh Jain 2023-11-08 17:33:26 +05:30 committed by GitHub
parent 5a84ed279d
commit 621d551c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -272,9 +272,13 @@ export const IssueForm: FC<IssueFormProps> = observer((props) => {
<Controller <Controller
control={control} control={control}
name="project" name="project"
render={({ field: { value, onChange } }) => ( rules={{
required: true,
}}
render={({ field: { value, onChange }, fieldState: { error } }) => (
<IssueProjectSelect <IssueProjectSelect
value={value} value={value}
error={error}
onChange={(val: string) => { onChange={(val: string) => {
onChange(val); onChange(val);
setActiveProject(val); setActiveProject(val);

View File

@ -1,6 +1,7 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import type { FieldError } from "react-hook-form";
// mobx store // mobx store
import { useMobxStore } from "lib/mobx/store-provider"; import { useMobxStore } from "lib/mobx/store-provider";
// popper js // popper js
@ -15,6 +16,7 @@ import { Check, Clipboard, Search } from "lucide-react";
export interface IssueProjectSelectProps { export interface IssueProjectSelectProps {
value: string; value: string;
onChange: (value: string) => void; onChange: (value: string) => void;
error?: FieldError;
} }
export const IssueProjectSelect: React.FC<IssueProjectSelectProps> = observer((props) => { export const IssueProjectSelect: React.FC<IssueProjectSelectProps> = observer((props) => {