render perf refinements (#1632)

* render performance improvements

* improve render perf

* remove logging

* lint

* improve memoziation
This commit is contained in:
Bruce Martin
2020-07-16 09:53:46 -07:00
committed by GitHub
parent 17c1145ee4
commit 2265bfc921
11 changed files with 163 additions and 114 deletions
@@ -1,4 +1,3 @@
// jshint esversion: 6
import React from "react";
import { connect } from "react-redux";
import { Button, ButtonGroup, AnchorButton, Tooltip } from "@blueprintjs/core";
@@ -8,15 +7,13 @@ import actions from "../../actions";
import CellSetButton from "./cellSetButtons";
@connect((state) => ({
config: state.config,
crossfilter: state.obsCrossfilter,
differential: state.differential,
celllist1: state.differential?.celllist1,
celllist2: state.differential?.celllist2,
diffexpMayBeSlow: state.config?.parameters?.["diffexp-may-be-slow"] ?? false,
diffexpCellcountMax: state.config?.limits?.["diffexp_cellcount_max"],
}))
class DiffexpButtons extends React.Component {
class DiffexpButtons extends React.PureComponent {
computeDiffExp = () => {
const { dispatch, differential } = this.props;
if (differential.celllist1 && differential.celllist2) {
@@ -42,13 +39,7 @@ class DiffexpButtons extends React.Component {
render() {
/* diffexp-related buttons may be disabled */
const {
differential,
diffexpMayBeSlow,
diffexpCellcountMax,
crossfilter,
dispatch,
} = this.props;
const { differential, diffexpMayBeSlow, diffexpCellcountMax } = this.props;
const haveBothCellSets =
!!differential.celllist1 && !!differential.celllist2;
@@ -72,17 +63,8 @@ class DiffexpButtons extends React.Component {
return (
<ButtonGroup className={styles.menubarButton}>
{/* eslint-disable react/jsx-props-no-spreading --- disable until eslint-config-airbnb v18.1.1*/}
<CellSetButton
{...{ differential, crossfilter, dispatch }}
eitherCellSetOneOrTwo={1}
/>
<CellSetButton
{...{ differential, crossfilter, dispatch }}
eitherCellSetOneOrTwo={2}
/>
{/* eslint-enable react/jsx-props-no-spreading --- end disable*/}
<CellSetButton eitherCellSetOneOrTwo={1} />
<CellSetButton eitherCellSetOneOrTwo={2} />
{!differential.diffExp ? (
<Tooltip
content={warnMaxSizeExceeded ? tipMessageWarn : tipMessage}