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

Only recreate table model when Data layer changes #2372

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

Carifio24
Copy link
Member

This PR implements a change(/bugfix?) requested by @aagoodman. Currently, after a user makes a selection to create a new subset after having sorted the table, the sorting is undone once the subset is created. This leads to a not-great UX - if one is trying to create multiple selections based on a column's values, having to re-sort each time is annoying.

The reason for this is that the table model is recreated any time the layers change, which resets any sorting. This PR modifies the layer changed callback to only recreate the table model if the actual Data layer has changed - otherwise, we just call the model's _update_visible. This also necessitates making the masks in _update_visible aware of the current order.

@Carifio24
Copy link
Member Author

Rebased to get CI fixes

@astrofrog
Copy link
Member

@Carifio24 - do you think it would be easy to add a test for this, or would it be non-trivial?

@Carifio24
Copy link
Member Author

@astrofrog I think it should actually be pretty straightforward. I'll try adding one and see if that is indeed the case.

@Carifio24
Copy link
Member Author

@astrofrog I just added a test - it creates a new subset and checks that the table model and the row ordering are preserved afterwards.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Looks good to me provided the CI passes!

@dhomeier dhomeier merged commit 4de94b5 into glue-viz:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants