Skip to content
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] Updating rows has a performance bottleneck (MissingRowIdError + try/catch) #15615

Closed
lauri865 opened this issue Nov 26, 2024 · 3 comments · Fixed by #15616
Closed
Labels
component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature performance

Comments

@lauri865
Copy link
Contributor

lauri865 commented Nov 26, 2024

Steps to reproduce

Steps:

  1. Open this link to live example
  2. Start performance measurements
  3. Click on "Replace rows" either just once or better yet 10 times in a fast sequence

My result – 25% of all scripting time is spent on try/catch handling:
Screenshot 2024-11-26 at 14 57 05

Current behavior

Cells and rows lose their state when rows are updated, but while the olds rows are still mounted.

Expected behavior

Ideally rows and cells should retain their state even through the whole rendering cycle.
However, I completely understand if that's difficult to fix.

The good enough alternative is to avoid throwing any errors and return null instead. Try/Catch logic has too much overhead in these hot code paths.

Context

We use setRows extensively, since we handle filtering outside of the Datagrid component. Setting rows on each keystroke when searching could benefit from an improved performance.

For fast changing grids, it would also reduce the need for row update throttling quite a bit.

Your environment

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

Search keywords: MissingRowIdError

@lauri865 lauri865 added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 26, 2024
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Nov 26, 2024
@michelengelen
Copy link
Member

Thanks @lauri865 for opening an issue for this. I will add it to the board for the team to have a look. If you have an idea how this could be improved feel free to open a PR yourself though. 👍🏼

@michelengelen michelengelen added enhancement This is not a bug, nor a new feature and removed bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 26, 2024
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Nov 26, 2024
@michelengelen michelengelen changed the title [DataGrid] Updating rows has a performance bottleneck (MissingRowIdError + try/catch) [data grid] Updating rows has a performance bottleneck (MissingRowIdError + try/catch) Nov 26, 2024
@lauri865
Copy link
Contributor Author

I already opened a PR ;) #15616

Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@lauri865 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature performance
Projects
Status: 🆕 Needs refinement
Development

Successfully merging a pull request may close this issue.

3 participants