-
-
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
Checkbox column appended instead of prepended in concurrent mode #1562
Comments
Oh wow, this one is amazing. I'm curious to see why. It could require changing the architecture if it surfaces a design assumption that doesn't hold. |
TBH, I'm not sure why we always have to question the architecture of the grid every time there is a new issue. Also changing the "architecture" at this stage would delay all the plans to go to beta, and stable. Concurrent mode is in experimental stage, I don't think this issue is worth looking at this stage. |
In my mind, "architecture" means the main pillars we depend on to account for the constraints of the real world and to shelter the features we are building around it. For the support of strict mode, we had to shift a bit our approach. Concurrent mode is a significant implementation shift in React, it sets new constraints. I think that the eventuality that the current structure won't hold with these new constraints is not impossible. I didn't intend to say more. I was about to make the same point 👍. The set of constraints that concurrent mode creates is not fixed, so maybe we have an issue right now, that will go away tomorrow (the inverse is also possible). |
Couple of things:
|
What would be the correct naming for |
This is on this weeks agenda. I should have a version of this behavior without tearing in v5. If that works as I think it does then I may even be able to write a lint rule that finds these "set state state in an effect" patterns. It seems to me these patterns are just applied out of convenience so we need to find a way to make the right pattern more convenient. |
It seems like you've implemented your own statement managment solution. I've traced the state changes and they all end up in some ref reassignment (https://github.com/mui-org/material-ui-x/blob/2cf4818737a96b983222f3c5e32d89d3303fa313/packages/grid/_modules_/grid/hooks/features/core/useGridState.ts#L22-L22) that will ultimately block most know React patterns from working. I'm fairly certain this is just derived state but due to the custom state managment you won't be able to unlock a lot of React's own perf optimizations (especially the ones coming with concurrent rendering). This is painfully obvious by the fact that you need to use a Consider But mixing these together creates problems with component composition. I've seens this mistake repeat over and over again (latest example are the picker components). And we have this pretty well documented in React in the controlled/uncontrolled components pattern and the derived state pattern. |
It's behaving correctly with v4.0.0-alpha.37: https://codesandbox.io/s/datagrid-legacy-vs-concurrent-root-forked-hkp39?file=/demo.js. We changed something along the way. |
If you can point me to the code that's responsible for inserting the column I can take a look to understand what's going wrong if you want.
Current Behavior 😯
When using
<DataGrid checkboxSelection />
the column containing the checkboxes is the last column in concurrent react.Expected Behavior 🤔
It should be the first column
Steps to Reproduce 🕹
https://codesandbox.io/s/datagrid-legacy-vs-concurrent-root-84z9o?file=/demo.js
Steps:
react@experimental
(currently0.0.0-experimental-79740da4c
)<DataGrid rows={rows} columns={columns} pageSize={5} checkboxSelection />
Context 🔦
Reproducible in our docs: https://60906bee09db3300076bbe72--material-ui.netlify.app/components/tables/#DataTable (mui/material-ui#26107)
Your Environment 🌎
See codesandbox. For the docs see the details below.
`npx @material-ui/envinfo`
Order id 💳
N/A
The text was updated successfully, but these errors were encountered: