Skip to content

Commit e108e58

Browse files
committed
replace watch with useWatch
1 parent e124aeb commit e108e58

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/Members/AddEditMemberDialog.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FC, useEffect, useMemo } from 'react';
22
import { Trans, useTranslation } from 'react-i18next';
33
import { z } from 'zod';
4-
import { useForm } from 'react-hook-form';
4+
import { useForm, useWatch } from 'react-hook-form';
55
import { zodResolver } from '@hookform/resolvers/zod';
66
import { Member, MemberRoles, memberRolesOptions } from '../../lib/api/types/shared/members.ts';
77
import { Button, Dialog, FlexBox, Input, Label, Link, MessageStrip } from '@ui5/webcomponents-react';
@@ -68,7 +68,7 @@ export const AddEditMemberDialog: FC<AddEditMemberDialogProps> = ({
6868
const {
6969
register,
7070
handleSubmit,
71-
watch,
71+
control,
7272
setValue,
7373
reset,
7474
formState: { errors },
@@ -83,8 +83,8 @@ export const AddEditMemberDialog: FC<AddEditMemberDialogProps> = ({
8383
},
8484
});
8585

86-
const accountType = watch('accountType');
87-
const role = watch('role');
86+
const accountType = useWatch({ control, name: 'accountType' });
87+
const role = useWatch({ control, name: 'role' });
8888

8989
useEffect(() => {
9090
if (open) {

0 commit comments

Comments
 (0)