Skip to content

Releases: react-hook-form/react-hook-form

🎄 Version 7.49.0

09 Dec 20:59
Compare
Choose a tag to compare

📮 feat: add reactive errors prop at useForm (#11188)

useForm({
  errors, // server errors
})

🖥️ feat: add react-server bundle (#11162)
🔩 chore: upgrade Node.js and pnpm (#11163)
🪖 feat: add ValidationModeFlags Type (#11144)
🐞 fix #11267 disabled prop does not affect controller validation (#11273)
🔧 refactor(util function): Enhance Consistency in Utility Functions: Standardizing Export, Function Types, and Naming (#11268)
⌨️ change type structure of UseFormHandleSubmit (#11245)
📮 fix(#11239): Set fields disabled state based on form and field disabled (#11241)
🍢 improved getDirtyFieldsFromDefaultValues type (#11238)
🐞 fix #11229 issue with values not re-render the root form (#11231)
🐞 fix #11218 useFieldArray focus issue with rules prop (#11221)
🔧 chore: improved isObjectType and swap (#11183)

thanks to @kotarella1110, @ssi02014, @thomasdbock, @mildfuzz and @Lennon57

Version 7.48.2

05 Nov 05:44
Compare
Choose a tag to compare

🐞 #11106 fix disabled prop not update dirty formState (#11143)
🐞 fix controller update with disabled prop from useForm (#11142)

Version 7.48.1

04 Nov 22:56
Compare
Choose a tag to compare

🐞 fix controller update with disabled prop from useForm

Version 7.48.0

04 Nov 21:05
Compare
Choose a tag to compare

🧱 feature: disable prop for useForm (#10496)

const App = () => {
  const [disabled, setDisabled] = useState(false);
  const { handleSubmit } = useForm({ disabled });

  return (
    <form
      onSubmit={handleSubmit(async () => {
        setDisabled(true);
        await sleep(100);
        setDisabled(false);
      })}
    / >
  );
}

😵‍💫 fixed typo in useFormContext (#11126)
🫡 strictly manage constants and improve types (#11101)
🐞 fix #11076 disable toggle issue (#11090)
🚀 fix: Solve the issue of race condition with resolver. (#10991)
📖 docs: fix useWatch example syntax error (#11005)
📝 readme arabic version (#10992)

thanks to @Iyadchafroud @domuk-k @mehunk @ssi02014 and @tykhan

Version 7.47.0

02 Oct 05:31
Compare
Choose a tag to compare

🫡 allow keepIsSubmitSuccessful flag (#9640)

const { reset } = useForm()

<Form
  onSubmit={() => {
    reset(formValues, {
      keepIsSubmitSuccessful: true,
    });
  }}
/>

🦉 fix typo in form.ts (#10978)
🤡 close #10907 potential fix on unmounted component (#10980)
🪖 simplify logic for subscription by name (#10947)

thanks to @stefanpl, @kai-dorschner-twinsity & @nitschSB

Version 7.46.2

21 Sep 10:51
Compare
Choose a tag to compare

🐞 fix implicit type coercion (#10949)
🙄 close #10932 omit disabled prop when not defined (#10937)
🔧 fix controller test is dirty (#10899)

thanks to @samimakicc & @pierluigigiancola

Version 7.46.1

04 Sep 21:37
Compare
Choose a tag to compare

🐞 fix #10878 return disabled field state (#10879)

thanks to @Moshyfawn

Version 7.46.0

03 Sep 11:58
Compare
Choose a tag to compare

🧟‍♂️ feat: support disabled prop for useController (#10810)

const [disabled, setDisabled] = useState(false)
useController({
  disabled
})
  • field value will be disabled
  • field value will be omitted

🫖 prevent reset argument mutation (#10847)
🐞 fix: add exact option for array name in useWatch. (#10707)
🐞 update isDirty when setting disabled in register (#10805)
🧶 feat: trigger passed names to construct resolver options (#10590)

thanks to @selimb @vonagam @jgullstr and @rabbitson87

Version 7.46.0-next.0

13 Aug 02:43
Compare
Choose a tag to compare
Version 7.46.0-next.0 Pre-release
Pre-release

disabled prop

  • new disabled props for useForm
  • allow user to disable the entire form with all associated inputs
useForm({
  disabled: true
})

const App = () => {
  const [disabled, setDisabled] = useState(false);
  const { register, handleSubmit, control } = useForm({
    disabled,
  });

  return (
    <form
      onSubmit={handleSubmit(async () => {
        setDisabled(true);
        await sleep(100);
        setDisabled(false);
      })}
    >
      <input
        type={'checkbox'}
        {...register('checkbox')}
        data-testid={'checkbox'}
      />
      <input type={'radio'} {...register('radio')} data-testid={'radio'} />
      <input type={'range'} {...register('range')} data-testid={'range'} />
      <select {...register('select')} data-testid={'select'} />
      <textarea {...register('textarea')} data-testid={'textarea'} />

      <Controller control={control} render={({ field }) => <input disabled={field.disabled}  />} name="test" />

      <button>Submit</button>
    </form>
  );
}

Version 7.45.4

05 Aug 13:36
Compare
Choose a tag to compare

🐞 fix #10767 dep issue with replayio (#10768)
🐞 fix #10762 async submit with Form component (#10766)
🫖 add test case for issue #10744 to avoid future regressions (#10759)

thanks to @eg-bernardo