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

sync table quadrants whenever col widths or row heights from props ch… #2118

Merged
merged 5 commits into from
Apr 16, 2018

Conversation

mcintyret
Copy link
Contributor

@mcintyret mcintyret commented Feb 9, 2018

This fixes an edge case where columns are moved from the unfrozen to the frozen area, and column widths are provided such that the moved column retains its width. Prior to this change such a move would look like this:

before moving:
image

after moving:
image

With this change it works as expected

@giladgray giladgray requested review from cmslewis, themadcreator and gscshoyru and removed request for cmslewis February 9, 2018 00:50
@giladgray
Copy link
Contributor

@mcintyret this is targeting develop so it will ship in table 2.0. is that acceptable for you? if you want it in 1.x then please open a new PR targeting release/1.x

@@ -730,6 +730,13 @@ export class Table extends AbstractComponent<ITableProps, ITableState> {
newSelectedRegions,
);

if (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we put this up on line 713 to co-locate it with the code that updates newColumnWidths and newRowHeights?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@themadcreator themadcreator left a comment

Choose a reason for hiding this comment

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

just a nit. otherwise LGTM

!CoreUtils.arraysEqual(newColumnWidths, this.state.columnWidths) ||
!CoreUtils.arraysEqual(newRowHeights, this.state.rowHeights)
) {
this.didUpdateColumnOrRowSizes = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that in other places we call this.invalidateGrid() when we set this to true. It looks like that's not strictly necessary since it's called 4 lines later, but maybe add a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could just move up the invalidateGrid() call to just below this block? Not sure what I would be trying to explain in a comment

@mcintyret
Copy link
Contributor Author

@giladgray thanks for the heads up. I don't think this fix is massively urgent as I don't expect people to hit it much, just noticed it as I was playing around. If that changes I'll make another PR.

@giladgray
Copy link
Contributor

@mcintyret just pushed a commit to address the one outstanding comment. will merge after ✅

@giladgray giladgray merged commit b6c06b4 into palantir:develop Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants