mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-26 00:58:12 +08:00
move initializer to constructor
This commit is contained in:
@@ -36,6 +36,7 @@ class HistogramBrush extends React.Component {
|
||||
this.width = 300;
|
||||
this.height = 100;
|
||||
this.marginBottom = 20;
|
||||
this.histogramCache = {};
|
||||
|
||||
this.state = {
|
||||
svg: null,
|
||||
@@ -55,8 +56,6 @@ class HistogramBrush extends React.Component {
|
||||
nextProps.metadataField
|
||||
);
|
||||
|
||||
this.histogramCache = {};
|
||||
|
||||
this.histogramCache.x = d3
|
||||
.scaleLinear()
|
||||
.domain([nextProps.ranges.min, nextProps.ranges.max])
|
||||
@@ -81,7 +80,7 @@ class HistogramBrush extends React.Component {
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (
|
||||
this.props.metadataField !== nextProps.metadataField ||
|
||||
!this.histogramCache
|
||||
!this.histogramCache.x
|
||||
) {
|
||||
this.calcHistogramCache(nextProps);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user