react-hook-form 7.39.2 → 7.39.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -360,10 +360,6 @@ function useController(props) {
360
360
  ...props.rules,
361
361
  value,
362
362
  }));
363
- const field = get(control._fields, name);
364
- if (field) {
365
- field._f._c = true;
366
- }
367
363
  React.useEffect(() => {
368
364
  const updateMounted = (name, value) => {
369
365
  const field = get(control._fields, name);
@@ -399,9 +395,15 @@ function useController(props) {
399
395
  },
400
396
  type: EVENTS.BLUR,
401
397
  }), [name, control]),
402
- ref: (ref) => {
403
- if (field && ref) {
404
- field._f.ref = ref;
398
+ ref: (elm) => {
399
+ const field = get(control._fields, name);
400
+ if (field && elm) {
401
+ field._f.ref = {
402
+ focus: () => elm.focus(),
403
+ select: () => elm.select(),
404
+ setCustomValidity: (message) => elm.setCustomValidity(message),
405
+ reportValidity: () => elm.reportValidity(),
406
+ };
405
407
  }
406
408
  },
407
409
  },
@@ -1689,7 +1691,7 @@ function createFormControl(props = {}) {
1689
1691
  }
1690
1692
  else {
1691
1693
  fieldReference.ref.value = fieldValue;
1692
- if (fieldReference._c) {
1694
+ if (!fieldReference.ref.type) {
1693
1695
  _subjects.watch.next({
1694
1696
  name,
1695
1697
  });