react-datasheet-grid
react-datasheet-grid copied to clipboard
onBlur firing twice if `autoAddRow = true` on DynamicDataSheetGrid
trafficstars
If autoAddRow = true and you are on the last row, once you press enter to confirm edit and auto-create new row, the onblur callback is called twice.
<DynamicDataSheetGrid
ref={gridRef}
value={data}
onChange={setData}
onBlur={() => {
console.log("blur");
}}
columns={columnsMemo}
autoAddRow
/>
If I instead use <DataSheetGrid/> the issue does not occurs.
Hey @ajboni, thx for the repport, I will have a look into it
Related to #230. Looks like the way onBlur is implemented is not based on cells' or elements' onBlur events but via useEffect in such a way that any table change will also trigger the provided onBlur function.
Thanks @nick-keller for looking into this!