react-hook-form 7.20.0 → 7.20.1

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.
package/dist/index.esm.js CHANGED
@@ -436,44 +436,44 @@ const useFieldArray = (props) => {
436
436
  const append$1 = (value, options) => {
437
437
  const appendValue = convertToArrayPayload(value);
438
438
  const updatedFieldArrayValuesWithKey = append(mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName), mapIds(appendValue, keyName));
439
+ setFields(updatedFieldArrayValuesWithKey);
439
440
  control._updateFieldArray(name, append, {
440
441
  argA: fillEmptyArray(value),
441
442
  }, updateValues(updatedFieldArrayValuesWithKey));
442
- setFields(updatedFieldArrayValuesWithKey);
443
443
  control._names.focus = getFocusFieldName(name, updatedFieldArrayValuesWithKey.length - appendValue.length, options);
444
444
  };
445
445
  const prepend$1 = (value, options) => {
446
446
  const updatedFieldArrayValuesWithKey = prepend(mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName), mapIds(convertToArrayPayload(value), keyName));
447
+ setFields(updatedFieldArrayValuesWithKey);
447
448
  control._updateFieldArray(name, prepend, {
448
449
  argA: fillEmptyArray(value),
449
450
  }, updateValues(updatedFieldArrayValuesWithKey));
450
- setFields(updatedFieldArrayValuesWithKey);
451
451
  control._names.focus = getFocusFieldName(name, 0, options);
452
452
  };
453
453
  const remove = (index) => {
454
454
  const updatedFieldArrayValuesWithKey = removeArrayAt(mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName), index);
455
+ setFields(updatedFieldArrayValuesWithKey);
455
456
  control._updateFieldArray(name, removeArrayAt, {
456
457
  argA: index,
457
458
  }, updateValues(updatedFieldArrayValuesWithKey));
458
- setFields(updatedFieldArrayValuesWithKey);
459
459
  };
460
460
  const insert$1 = (index, value, options) => {
461
461
  const updatedFieldArrayValuesWithKey = insert(mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName), index, mapIds(convertToArrayPayload(value), keyName));
462
+ setFields(updatedFieldArrayValuesWithKey);
462
463
  control._updateFieldArray(name, insert, {
463
464
  argA: index,
464
465
  argB: fillEmptyArray(value),
465
466
  }, updateValues(updatedFieldArrayValuesWithKey));
466
- setFields(updatedFieldArrayValuesWithKey);
467
467
  control._names.focus = getFocusFieldName(name, index, options);
468
468
  };
469
469
  const swap = (indexA, indexB) => {
470
470
  const updatedFieldArrayValuesWithKey = mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName);
471
471
  swapArrayAt(updatedFieldArrayValuesWithKey, indexA, indexB);
472
+ setFields(updatedFieldArrayValuesWithKey);
472
473
  control._updateFieldArray(name, swapArrayAt, {
473
474
  argA: indexA,
474
475
  argB: indexB,
475
476
  }, updateValues(updatedFieldArrayValuesWithKey), false);
476
- setFields(updatedFieldArrayValuesWithKey);
477
477
  };
478
478
  const move = (from, to) => {
479
479
  const updatedFieldArrayValuesWithKey = mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName);
@@ -488,16 +488,16 @@ const useFieldArray = (props) => {
488
488
  const updatedFieldArrayValuesWithKey = mapCurrentIds(control._getFieldArray(name), _fieldIds, keyName);
489
489
  const updatedFieldArrayValues = updateAt(updatedFieldArrayValuesWithKey, index, value);
490
490
  _fieldIds.current = mapIds(updatedFieldArrayValues, keyName);
491
+ setFields(_fieldIds.current);
491
492
  control._updateFieldArray(name, updateAt, {
492
493
  argA: index,
493
494
  argB: value,
494
495
  }, updateValues(_fieldIds.current), true, false);
495
- setFields(_fieldIds.current);
496
496
  };
497
497
  const replace = (value) => {
498
498
  const updatedFieldArrayValuesWithKey = mapIds(convertToArrayPayload(value), keyName);
499
- control._updateFieldArray(name, () => updatedFieldArrayValuesWithKey, {}, updateValues(updatedFieldArrayValuesWithKey), true, false);
500
499
  setFields(updatedFieldArrayValuesWithKey);
500
+ control._updateFieldArray(name, () => updatedFieldArrayValuesWithKey, {}, updateValues(updatedFieldArrayValuesWithKey), true, false);
501
501
  };
502
502
  React.useEffect(() => {
503
503
  control._stateFlags.action = false;