_.get fixes

This commit is contained in:
Colin Megill
2018-07-23 17:06:32 -04:00
parent 516ecc2ad3
commit b574542a60
5 changed files with 19 additions and 63 deletions
@@ -30,7 +30,7 @@ class Category extends React.Component {
componentDidUpdate() {
const valuesAsBool = _.values(
this.props.categoricalAsBooleansMap[this.props.metadataField]
)
);
/* count categories toggled on by counting true values */
const categoriesToggledOn = _.values(valuesAsBool).filter(v => v).length;
@@ -80,13 +80,13 @@ class Category extends React.Component {
});
}
handleToggleAllClick() {
// || this.checkbox.indeterminate === false
// || this.checkbox.indeterminate === false
if (this.state.isChecked) {
console.log('checked, firing toggle none')
console.log("checked, firing toggle none");
this.toggleNone();
} else if (!this.state.isChecked) {
console.log('!checked, firing toggle all')
this.toggleAll()
console.log("!checked, firing toggle all");
this.toggleAll();
}
}
render() {
@@ -131,7 +131,7 @@ class Category extends React.Component {
{this.props.metadataField}
<input
onChange={this.handleToggleAllClick.bind(this)}
ref={el => this.checkbox = el}
ref={el => (this.checkbox = el)}
checked={this.state.isChecked}
type="checkbox"
/>
@@ -164,10 +164,7 @@ class Category extends React.Component {
}
@connect(state => {
const ranges =
state.cells.cells && state.cells.cells.data.ranges
? state.cells.cells.data.ranges
: null;
const ranges = _.get("state.cells.cells.data.ranges", null);
return {
ranges