-
Notifications
You must be signed in to change notification settings - Fork 24
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
Save expanded/collapsed state of segment groups #7928
Conversation
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backend LGTM :) Testing worked nicely, backwards compatibility looks OK. As mentioned in Slack, the root group gets expanded again after reload, raising the question if it needs to be collapsible in the first place, but I’d say that’s not particularly important.
Please add a changelog entry :)
I am not 100% sure, but I feel like expanding and collapsing got slower. I compared it to webknossos.org and I am still not super sure. But I wanted to mention it. Maybe there is a faster way to get the current expanded/collapsed group state from the segmentGroups? @philippotto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool :) I left some feedback.
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Show resolved
Hide resolved
Store.dispatch(setSegmentGroupsAction(newGroups, this.props.visibleSegmentationLayer?.name)); | ||
}; | ||
|
||
collapseGroups = (groupsToCollapse: Key[]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why doesn't this method handle the root group like the expandGroups
method does? is it not necessary in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also: the two methods differ in their semantics of the parameters. for collapseGroups
I understand it so that the referenced groups will be collapsed (and other collapsed groups will stay as before). for expandGroups
, it seems like only the referenced groups should be expanded (and all the others should not be expanded). can this be unified?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right, the methods differ. this is because expandGroups
is called by the Tree component and the expandSubgroups
menu entry. collapseGroups
is only called to collapse the children. The tree component also calls this if groups are collapsed, by removing the collapsed groups trees from the list. Thus isExpanded
has to be set to false for these groups. Other than that, the root group is handled differently because on expand all subgroups
the parent group is expanded if it was collapsed before. This is different for expanded groups, their state doesn't change if their children are collapsed.
I could use three methods: one for the Tree component and two for "collapse/expand subgroups". And then comment what I said above. Do you think that this might be a good solution? @philippotto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I understand. two methods are fine then. I'd the expandGroups
method to setExpandedGroups
. That way, it should be clearer that the semantics is different to collapseGroups
.
Other than that, the root group is handled differently because on expand all subgroups the parent group is expanded if it was collapsed before. This is different for expanded groups, their state doesn't change if their children are collapsed.
A comment for that would be good, yes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong: this code snippet enables an update of the root group itself. the state update (isRootGroupExpanded
) triggers an update of the root group object which is separate because the rootgroup is only stored in the component.
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segments_view.tsx
Outdated
Show resolved
Hide resolved
Only after reviewing, I noticed that this PR is based on #7911. I manually changed the base of the PR now. In the future, you should do this when creating the PR :) Can be done here: Otherwise, all the changes of the first PR will also be shown here in the diff, too. |
I see. So I set it to the base branch although I will merge it into master eventually. And then I can probably set it to master once the base branch is merged and I have rebased the commits of this PR, right? |
Exactly! Even better, GitHub will automatically set the base to "master" once the first PR is merged. |
939ab91
to
e32ba49
Compare
@philippotto because of the different base branch I rebased my changes on master. The numbers of the diff are slightly different (used to be +170, -12). I hope that is somewhat expected. It still works well, so I hope the rebase was fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 🎉 Performance feels still a bit laggy, but this is unrelated to this PR. Let's merge it and iterate later :)
Thank you for the review! I feel like the skeleton tab made some different decisions regarding the removal of "unnecessary" options, by just showing them and saving some cost there. Maybe that is among the things to look out for. |
Steps to test:
TODOs:
Issues:
(Please delete unneeded items, merge only when none are left open)