fix: FilterBox JS when no results (#10143)

This commit is contained in:
Jesse Yang 2020-06-24 08:09:14 -07:00 committed by GitHub
parent 763b38591c
commit 4e71491d86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -143,7 +143,7 @@ class FilterBox extends React.Component {
let vals = null;
if (options !== null) {
if (Array.isArray(options)) {
vals = options.map(opt => opt.value);
vals = options.map(opt => (typeof opt === 'string' ? opt : opt.value));
} else if (options.value) {
vals = options.value;
} else {
@ -254,7 +254,7 @@ class FilterBox extends React.Component {
});
});
const { key, label } = filterConfig;
const data = this.props.filtersChoices[key];
const data = filtersChoices[key] || [];
const max = Math.max(...data.map(d => d.metric));
let value = selectedValues[key] || null;