-
Notifications
You must be signed in to change notification settings - Fork 139
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
fix(datagrid): add useMemo() calls #5949
base: main
Are you sure you want to change the base?
Conversation
Add useMemo() wrappers to useRowRenderer() and useSelectRows() to avoid needless Datagrid rerenders. Fixes carbon-design-system#5908, refs carbon-design-system#5930.
✅ Deploy Preview for carbon-for-ibm-products ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @wkeese, I observe that these changes prevents the re-updation of rows[], but aren't fixing the re-rendering of the rows, which was the main objective of the issue if I am right. Screen.Recording.2024-08-29.at.6.47.12.PM.mov |
Hi @devadula-nandan. Thanks for looking at this! I think my PR is just one step on a long road to fixing the problem. I didn't know about the problem with callbacks. Can we fix it with I thought there was another issue too though, with the I've never used that react profiling tab. Is that what told you about the callback props changing? |
Update: I see the issue is with the root constantly rendering. As you can observe In my reduced case the |
Well, the code you're talking about was just to make a simple test case. The actual culprit, for unknown reasons, is useColumnRightAlign(). |
Closes #5908, refs #5930.
Add useMemo() wrappers to useRowRenderer() and useSelectRows() to avoid needless Datagrid rerenders.
What did you change?
Added useMemo() wrappers in useRowRenderer() and useSelectRows() to avoid resetting datagridState.rows unnecessarily.
How did you test and verify your work?
Ran storybook examples and tested in my own app.
I suggest diffing ignoring whitespace.