Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃拞馃徎 fix #9621 with inline default value #9622

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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