-
-
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
[DataGridPro] Fix lazy loading error when existing rows are passed to replaceRows
#10821
Conversation
Deploy preview: https://deploy-preview-10821--material-ui-x.netlify.app/ |
b536b83
to
9c66656
Compare
Any news on this? It seems to me that this is quite a bug. |
I'm not sure I understand the problem and I haven't been able to trigger an error with the linked demo. Can you clarify the problem and the steps to reproduce? |
You should be able to trigger the error if you open the sandbox demo:
Then I see the error in the screen:
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I've been able to reproduce the issue. Could you solve the conflicts so we can merge the PR? |
9c66656
to
6810385
Compare
@romgrk: I rebased the PR against mui-x/next branch. I didn't get any conflicts however. Is it ok to merge now? |
replaceRows
…10821) Co-authored-by: Rom Grk <romgrk.cc@gmail.com>
…10821) Co-authored-by: Rom Grk <romgrk.cc@gmail.com>
It seems there a sorting issue in combination with the lazy loader. When
unstable_replaceRows
is called having existing rows in a different order,useGridRows
gives an error because it can't find rows because they have been deleted before.This behavior can be seen in the following demo. This is a fork of the lazy loading example from the documentation with rowLength adjusted to 10. To trigger the error simply change the order of the Name column.
https://codesandbox.io/s/nifty-pike-slzjmd?file=/src/Demo.tsx
This PR includes a suggested fix and test. Let me know if any change is needed and we're happy to update it.