-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add GroupingChooserModel.setDimensions()
#3743
Conversation
cmp/grouping/GroupingChooserModel.ts
Outdated
@@ -308,7 +319,7 @@ export class GroupingChooserModel extends HoistModel { | |||
return sortBy( | |||
this.favorites.map(value => ({ | |||
value, | |||
label: this.getValueLabel(value) | |||
label: this.getValueLabel(value) ?? value |
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 not have getValueLabel
handle the edge case ?
+ Early-out if all dims remained in place
+ Make dimensionNames private - did not look like this was anything that needed to be a public property, ensures this stays in sync with dimensions, only settable from within `setDimensions()`
GroupingChooserModel.setDimensions()
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.
Tested this out for my use case and worked perfectly.
Am now able to create the GroupingChooserModel as a readonly
member of my model with no dimensions, and I can set the dimensions when I load initial state in my model or when the relevant state changes to determine the dimensions - no more re-creating models and much less/simpler code!
@Ryanseanlee I think we just need a changelog entry and this can be merged |
Great thanks much - I'll add that in now and merge it. 🚀 |
Hoist P/R Checklist
Pull request authors: Review and check off the below. Items that do not apply can also be
checked off to indicate they have been considered. If unclear if a step is relevant, please leave
unchecked and note in comments.
develop
branch as of last change.breaking-change
label + CHANGELOG if so.If your change is still a WIP, please use the "Create draft pull request" option in the split
button below to indicate it is not ready yet for a final review.