react-hook-form 7.39.1 → 7.39.2

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,6 +360,10 @@ 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
+ }
363
367
  React.useEffect(() => {
364
368
  const updateMounted = (name, value) => {
365
369
  const field = get(control._fields, name);
@@ -395,15 +399,9 @@ function useController(props) {
395
399
  },
396
400
  type: EVENTS.BLUR,
397
401
  }), [name, control]),
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
- };
402
+ ref: (ref) => {
403
+ if (field && ref) {
404
+ field._f.ref = ref;
407
405
  }
408
406
  },
409
407
  },
@@ -1691,7 +1689,7 @@ function createFormControl(props = {}) {
1691
1689
  }
1692
1690
  else {
1693
1691
  fieldReference.ref.value = fieldValue;
1694
- if (!fieldReference.ref.type) {
1692
+ if (fieldReference._c) {
1695
1693
  _subjects.watch.next({
1696
1694
  name,
1697
1695
  });