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