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

Fix columns #542

Merged
merged 4 commits into from
Nov 6, 2020
Merged

Fix columns #542

merged 4 commits into from
Nov 6, 2020

Conversation

dtassone
Copy link
Member

@dtassone dtassone commented Nov 5, 2020

No description provided.

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was wrong? From a distant perspective, it looks like the logic in useColumns is correct but we had a regression in the state logic, hence the current fix is only hiding it, without going after the root issue.

@dtassone
Copy link
Member Author

dtassone commented Nov 5, 2020

What was wrong? From a distant perspective, it looks like the logic in useColumns is correct but we had a regression in the state logic, hence the current fix is only hiding it, without going after the root issue.

Well it makes sense to call it on resize as columns look at the size of the grid, and the container state is changed according to the total column size...
As I mention this area needs refactoring

@dtassone
Copy link
Member Author

dtassone commented Nov 6, 2020

I'm merging this one as it's blocking all the other PRs, we can open an issue or investigate separately.

@dtassone dtassone merged commit 983d7aa into mui:master Nov 6, 2020
@oliviertassinari
Copy link
Member

oliviertassinari added a commit that referenced this pull request Nov 6, 2020
This reverts commit 983d7aa.
Comment on lines +235 to +241
const onResize = React.useCallback(
(size) => {
resetColumns(size.width);
},
[resetColumns],
);
useApiEventHandler(apiRef, RESIZE, onResize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand gridState.containerSizes?.viewportSize.width already depends on the resize event, so this whole block is duplicated logic.

dtassone added a commit to dtassone/material-ui-x that referenced this pull request Nov 9, 2020
* refactor columns

* Fix columns test

* remove dependency on viewport

* fix test, reverted last commit
dtassone pushed a commit to dtassone/material-ui-x that referenced this pull request Nov 9, 2020
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Jan 17, 2023
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants