fix: focus getting removed from description while typing

This commit is contained in:
dakshesh14 2023-11-06 13:31:04 +05:30
parent 6aaf9642bb
commit 855c65bc87
2 changed files with 3 additions and 13 deletions

View File

@ -132,7 +132,6 @@ export const DraftIssueForm: FC<IssueFormProps> = (props) => {
control, control,
getValues, getValues,
setValue, setValue,
setFocus,
} = useForm<IIssue>({ } = useForm<IIssue>({
defaultValues: prePopulatedData ?? defaultValues, defaultValues: prePopulatedData ?? defaultValues,
reValidateMode: "onChange", reValidateMode: "onChange",
@ -250,14 +249,12 @@ export const DraftIssueForm: FC<IssueFormProps> = (props) => {
}; };
useEffect(() => { useEffect(() => {
setFocus("name");
reset({ reset({
...defaultValues, ...defaultValues,
...(prePopulatedData ?? {}), ...(prePopulatedData ?? {}),
...(data ?? {}), ...(data ?? {}),
}); });
}, [setFocus, prePopulatedData, reset, data]); }, [prePopulatedData, reset, data]);
// update projectId in form when projectId changes // update projectId in form when projectId changes
useEffect(() => { useEffect(() => {
@ -359,6 +356,7 @@ export const DraftIssueForm: FC<IssueFormProps> = (props) => {
id="name" id="name"
name="name" name="name"
type="text" type="text"
tabIndex={1}
value={value} value={value}
onChange={onChange} onChange={onChange}
ref={ref} ref={ref}

View File

@ -46,15 +46,7 @@ const issueService = new IssueService();
const moduleService = new ModuleService(); const moduleService = new ModuleService();
export const CreateUpdateDraftIssueModal: React.FC<IssuesModalProps> = observer((props) => { export const CreateUpdateDraftIssueModal: React.FC<IssuesModalProps> = observer((props) => {
const { const { data, handleClose, isOpen, prePopulateData: prePopulateDataProps, fieldsToShow = ["all"], onSubmit } = props;
data,
handleClose,
isOpen,
prePopulateData: prePopulateDataProps,
fieldsToShow = ["all"],
onSubmit,
} = props;
// states // states
const [createMore, setCreateMore] = useState(false); const [createMore, setCreateMore] = useState(false);