react-hook-form 7.28.0-next.0 → 7.28.0

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.
@@ -910,9 +910,7 @@ function unset(object, path) {
910
910
  if (currentPathsLength === index &&
911
911
  ((isObject(objectRef) && isEmptyObject(objectRef)) ||
912
912
  (Array.isArray(objectRef) &&
913
- !objectRef.filter((data) => (isObject(data) && !isEmptyObject(data)) ||
914
- isBoolean(data) ||
915
- (Array.isArray(data) && data.length)).length))) {
913
+ !objectRef.filter((data) => !isUndefined(data)).length))) {
916
914
  previousObjRef ? delete previousObjRef[item] : delete object[item];
917
915
  }
918
916
  previousObjRef = objectRef;
@@ -1807,7 +1805,7 @@ function createFormControl(props = {}) {
1807
1805
  set(_fields, name, {
1808
1806
  _f: Object.assign(Object.assign({}, field._f), (radioOrCheckbox
1809
1807
  ? {
1810
- refs: refs.concat(fieldRef).filter(live),
1808
+ refs: [...refs.filter(live), fieldRef],
1811
1809
  ref: { type: fieldRef.type, name },
1812
1810
  }
1813
1811
  : { ref: fieldRef })),