Skip to content

Commit

Permalink
馃拞馃徎 fix #9621 with inline default value
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebill1049 committed Dec 19, 2022
1 parent cc2a96e commit f0b5a44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/logic/createFormControl.ts
Expand Up @@ -501,6 +501,7 @@ export function createFormControl<
: defaultValue),
},
isGlobal,
defaultValue,
);

const _getFieldArray = <TFieldArrayValues>(
Expand Down
7 changes: 4 additions & 3 deletions src/logic/generateWatchOutput.ts
@@ -1,16 +1,17 @@
import { FieldValues, Names } from '../types';
import { DeepPartial, FieldValues, Names } from '../types';
import get from '../utils/get';
import isString from '../utils/isString';

export default (
export default <T>(
names: string | string[] | undefined,
_names: Names,
formValues?: FieldValues,
isGlobal?: boolean,
defaultValue?: DeepPartial<T>,
) => {
if (isString(names)) {
isGlobal && _names.watch.add(names);
return get(formValues, names);
return get(formValues, names, defaultValue);
}

if (Array.isArray(names)) {
Expand Down

0 comments on commit f0b5a44

Please sign in to comment.