I am using fluent-ui's DetailsList to render a table. I am trying to convert this into a simple editable grid. The 1st column is a readonly string, the 2nd column is an editable TextField and the 3rd column is the delete button. I have provided ItemColumn rendering function so that each column can be rendered as desired. See the following demo:
https://codesandbox.io/p/sandbox/detailslist-delete-broken-gfnrgn?file=%2Fsrc%2Findex.tsx%3A74%2C43
I have provided 2 rows, with the first row having the default value in the textfield of "Blue", and the second row having blank.
The problem: when I click on the delete button in the first row, the color is preserved at that index. So now it looks like Beagal's favorite color is "Blue", when it was in fact John's. This only seems to be a problem with Input columns, and not readonly columns like "Name" in this example, which is why "Beagal" correctly shifts up upon delete of the row above it. This is extra confusing because when I log the listItems state variable, it looks correct, so it's like the grid isn't properly re-rendering the TextField or something.
How to I ensure that when I delete a row, the TextField doesn't show the data from the row below it?