react-hook-form 7.22.2 → 7.22.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.
@@ -235,14 +235,11 @@ function useController(props) {
235
235
  updateMounted(name, true);
236
236
  return () => {
237
237
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
238
- if (isArrayField
238
+ isArrayField
239
239
  ? _shouldUnregisterField && !control._stateFlags.action
240
- : _shouldUnregisterField) {
241
- control.unregister(name, { keepDefaultValue: true });
242
- }
243
- else {
244
- updateMounted(name, false);
245
- }
240
+ : _shouldUnregisterField
241
+ ? control.unregister(name)
242
+ : updateMounted(name, false);
246
243
  };
247
244
  }, [name, control, isArrayField, shouldUnregister]);
248
245
  return {