nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.41k stars 1.39k forks source link

[BUG] - Input value disappears on hover with asynchronous values using React Hook Form #3588

Open alexnguyennz opened 1 month ago

alexnguyennz commented 1 month ago

NextUI Version

2.4.6

Describe the bug

Have encountered this issue posted here:

Asynchronous default values are disappearing from <Input> on hover. Issue doesn't occur on plain <input> tags. Wrapping in a <Controller/> doesn't fix.

When loading in values, the value is reset when hovering over the input.

Your Example Website or App

https://codesandbox.io/p/devbox/great-sara-fcx6hm?file=%2FApp.jsx

Steps to Reproduce the Bug or Issue

  1. Hover over text input

Expected behavior

Value doesn't disappear

Screenshots or Videos

No response

Operating System Version

Windows

Browser

Chrome

linear[bot] commented 1 month ago

ENG-1234 [BUG] - Input value disappears on hover with asynchronous values using React Hook Form

ameybh commented 1 month ago
<Controller
  control={control}
  name="email"
  render={({ field: { value } }) => (
    <Input value={value} {...register("email")} />
  )}
/>

This seems to solve the issue for me. Please try this and let me know.

alexnguyennz commented 4 weeks ago

Yep using Controller does work as a workaround.