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

[DataGrid] Using mouseup event for focus affects performance #9118

Closed
romgrk opened this issue May 25, 2023 · 4 comments
Closed

[DataGrid] Using mouseup event for focus affects performance #9118

romgrk opened this issue May 25, 2023 · 4 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! performance

Comments

@romgrk
Copy link
Contributor

romgrk commented May 25, 2023

After the change in #6489, the grid focus now happens on the mouseup event. Unfortunately, this means that react can't batch the updates that happen during the click event, so it needs to render twice whenever there is a focus change.

React.useEffect(() => {
const doc = ownerDocument(apiRef.current.rootElementRef!.current);
doc.addEventListener('mouseup', handleDocumentClick);
return () => {
doc.removeEventListener('mouseup', handleDocumentClick);
};
}, [apiRef, handleDocumentClick]);

We should revert that change and fix the demo issue otherwise.

@romgrk romgrk added status: waiting for maintainer These issues haven't been looked at yet by a maintainer performance component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 25, 2023
@romgrk
Copy link
Contributor Author

romgrk commented May 25, 2023

cc @cherniavskii

@cherniavskii
Copy link
Member

@romgrk I don't think I understand the batching issue here.
I tried both mouseup and click, and the task takes roughly the same time in both cases:

mouseup
mouseup

click
click

Am I missing something?

@romgrk
Copy link
Contributor Author

romgrk commented Apr 17, 2024

Closing, stale.

@romgrk romgrk closed this as completed Apr 17, 2024
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.

@romgrk: 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! performance
Projects
None yet
Development

No branches or pull requests

2 participants