fix: Use correct values on append DayRange (#8597)
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
1 parent
ee9f80ae3b
commit
99f736b317
1 file changed
+2
-1
@@ -169,6 +169,7 @@ export const DayRanges = <TFieldValues extends FieldValues>({
|
||||
control?: Control<TFieldValues>;
|
||||
}) => {
|
||||
const { t } = useLocale();
|
||||
const { getValues } = useFormContext();
|
||||
|
||||
const { remove, fields, append } = useFieldArray({
|
||||
control,
|
||||
@@ -191,7 +192,7 @@ export const DayRanges = <TFieldValues extends FieldValues>({
|
||||
StartIcon={Plus}
|
||||
onClick={() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const nextRange: any = getNextRange(fields[fields.length - 1]);
|
||||
const nextRange: any = getNextRange(getValues(`${name}.${fields.length - 1}`));
|
||||
if (nextRange) append(nextRange);
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user