-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data grid] processRowUpdate
misbehaves when row is removed right before it fires
#13707
Comments
@Janpot not sure if I am missing something here Once the row is out of the draft, it is removed from const rows = React.useMemo(
() => (draft ? [draft, ...rowsFromExternalApi] : rowsFromExternalApi),
[draft]
); This is why row data cannot be fetched here and we end up with the error (in dev mode) and some missing data in the callback args Having a separate https://stackblitz.com/edit/react-xqph3o-j4obgd?file=Demo.tsx |
IMO the example is too simplistic:
|
Lets add this to the board for further discussion! |
processRowUpdate
misbehaves when row is removed right before it firesprocessRowUpdate
misbehaves when row is removed right before it fires
Steps to reproduce
Link to live example: https://stackblitz.com/edit/react-xqph3o?file=Demo.tsx
Steps:
Current behavior
it prints
The original row is lost, as well as the id in the updated row. Note that this
null
is also inconsistent with the type signature.Expected behavior
It should print
Alternatively one could argue the types should be updated, but that effectively results into a loss of information in the API. i.e. you lose the start value to compare with as well as the assigned id.
Context
Trying to build a more reliable version of the CRUD example I've ran into this several times.
Your environment
npx @mui/envinfo
Search keywords: processRowUpdate null
The text was updated successfully, but these errors were encountered: