Skip to content

Version 7.23.0

Compare
Choose a tag to compare
@bluebill1049 bluebill1049 released this 12 Jan 09:30
· 577 commits to master since this release

Happy new year 2022!

馃捇 Feature/avoid omitting key name use field array (improve DX) (#7301)

const App = () => {
  const { control, register, handleSubmit } = useForm<FormValues>({
    defaultValues: {
      test: [{id: 'UUID5678', test: 'data' }] // id will be remained as it match default keyName
    }
  });
  const { fields, append } = useFieldArray({
    control,
    name: 'test',
  });

  return (
    <form>
      {fields.map((field, index) => {
        return <input key={field.id} {...register(`test.${index}.test`)} />;
      })}

      <button
        type={'button'}
        onClick={() => {
          append({
            id: 'UUID1234', // id value will be remained as it match default keyName
            test: '1234',
          });
        }}
      >
        append
      </button>
    </form>
  );
};

馃摬 apply useCallback for callback function to improve perf (#7378)
馃惙 test coverage for types (#7311)
馃悗 improve useFieldArray performance with separate id state (#7447)
馃帺 close #6776 improve register to support shadow roots (#7400)
馃搰 fix type infer with UseFormHandleSubmit (#7405)
馃帎 remove resolutions dep and update packages (#7396)
馃幖 import type for utility
馃 improve useFormState with mounted ref to skip update when hook is unmounted (#7489)
馃獢 improve updateFieldArray batch update (#7477)
馃 revert #6834 clearError should not affect isValid (#7470)

thanks to @daisuke85a, @michaltarasiuk, @adrianos10, @barrymay and @felixschorer!