Fixes edge case on conversion metric automatic change (#1939)

pull/1938/head
Vignesh Joglekar 5 years ago committed by GitHub
parent 2ebdf61c2b
commit e82131b2f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -349,14 +349,12 @@ export default class VisitorGraph extends React.Component {
const topStatLabels = topStatData && topStatData.top_stats.map(({ name }) => METRIC_MAPPING[name]).filter(name => name)
const prevTopStatLabels = prevState.topStatData && prevState.topStatData.top_stats.map(({ name }) => METRIC_MAPPING[name]).filter(name => name)
if (topStatLabels && `${topStatLabels}` !== `${prevTopStatLabels}`) {
if (!topStatLabels.includes(savedMetric) && savedMetric !== "") {
if (this.props.query.filters.goal && metric !== 'conversions') {
this.setState({ metric: 'conversions' })
} else {
this.setState({ metric: topStatLabels[0] })
}
} else {
if (this.props.query.filters.goal && metric !== 'conversions') {
this.setState({ metric: 'conversions' })
} else if (topStatLabels.includes(savedMetric) && savedMetric !== "") {
this.setState({ metric: savedMetric })
} else {
this.setState({ metric: topStatLabels[0] })
}
}
}

Loading…
Cancel
Save