useFieldArray with a search filter values in the row are not persisted in v6 #7639
-
https://codesandbox.io/s/amazing-rgb-ny637 The above sandbox have a list of objects with Steps to test
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
So, here's what I found.
<Controller
name={`data.${i}.localName`}
/>
See this CSB |
Beta Was this translation helpful? Give feedback.
-
hi @cyrilgeorgemv import { useState } from "react"; export default function App() { <input type="search" placeholder="Search" value={s} onChange={(e) => setS(e.target.value)} /> <ul style={{ gap: "1rem", display: "grid" }}> <li style={{ display: "flex", justifyContent: "space-around" }} > Name Local Name {aArray.fields .filter((f) => f.name.includes(s)) .map((f, i) => ( <li key={f.id} style={{ display: "flex", justifyContent: "space-around" }} > {f.name} <Controller control={control} defaultValue={f.localName} name={f.name} render={({ field: { onChange, value } }) => ( <input value={value} onChange={(e) => onChange(e.target.value)} /> )} /> ))} Submit ); } |
Beta Was this translation helpful? Give feedback.
So, here's what I found.
<Controller />
See this CSB