mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

Full Featured Component CRUD error when deleting element

Open experimarketing opened this issue 2 years ago • 0 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

This is the demo: https://codesandbox.io/s/3hceoe?file=/demo.tsx

This is the source: https://mui.com/x/react-data-grid/editing/#full-featured-crud-component

When you delete an element in the demo and then click on the header, it throws an error:

Error
No row with id #0b2d2706-c4b2-540f-b0fd-affd3e98ca42 found

Also, if you click delete, then click on the edit icon for another one, then save that, then click on the header, it won't throw the error.

Expected behavior 🤔

No response

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/3hceoe?file=/demo.tsx

Steps:

  1. Click Delete Icon
  2. Click on "Date Created"

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Order ID 💳 (optional)

34169

experimarketing avatar Aug 09 '22 14:08 experimarketing

Hi, @experimarketing thanks for raising this!

I can reproduce the problem. It seems to be related to setRows and that it doesn't update the state correctly. It look like it can be related to https://github.com/mui/mui-x/issues/5736

DanailH avatar Aug 11 '22 08:08 DanailH

I'll close this one because it looks like a duplicate. You can track the progress in the linked issue -> https://github.com/mui/mui-x/issues/5736

DanailH avatar Aug 11 '22 08:08 DanailH

I'm reopening it, as it doesn't seem to be a duplicate since the demo doesn't use apiRef.current.setRows method

cherniavskii avatar Sep 02 '22 11:09 cherniavskii