{
- dispatch(actions.subsetAction());
- }}
- handleSubsetReset={() => {
- dispatch(actions.resetSubsetAction());
- }}
+ subsetPossible={subsetPossible}
+ subsetResetPossible={subsetResetPossible}
+ handleSubset={this.handleSubset}
+ handleSubsetReset={this.handleSubsetReset}
/>
{disableDiffexp ? null : }
diff --git a/client/src/components/menubar/infoMenu.js b/client/src/components/menubar/infoMenu.js
index c0eed627..ee6a6496 100644
--- a/client/src/components/menubar/infoMenu.js
+++ b/client/src/components/menubar/infoMenu.js
@@ -3,7 +3,7 @@ import React from "react";
import { Button, Popover, Menu, MenuItem, Position } from "@blueprintjs/core";
import styles from "./menubar.css";
-function InformationMenu(props) {
+const InformationMenu = React.memo((props) => {
const { libraryVersions, aboutLink, tosURL, privacyURL } = props;
return (
@@ -72,6 +72,6 @@ function InformationMenu(props) {
);
-}
+});
export default InformationMenu;
diff --git a/client/src/components/menubar/subset.js b/client/src/components/menubar/subset.js
index 270ef205..03025cb3 100644
--- a/client/src/components/menubar/subset.js
+++ b/client/src/components/menubar/subset.js
@@ -3,7 +3,7 @@ import { AnchorButton, ButtonGroup, Tooltip } from "@blueprintjs/core";
import styles from "./menubar.css";
import * as globals from "../../globals";
-function Subset(props) {
+const Subset = React.memo((props) => {
const {
subsetPossible,
subsetResetPossible,
@@ -41,6 +41,6 @@ function Subset(props) {
);
-}
+});
export default Subset;
diff --git a/client/src/components/menubar/undoRedo.js b/client/src/components/menubar/undoRedo.js
index dba4d048..601dba32 100644
--- a/client/src/components/menubar/undoRedo.js
+++ b/client/src/components/menubar/undoRedo.js
@@ -1,10 +1,9 @@
-// jshint esversion: 6
import React from "react";
import { AnchorButton, Tooltip } from "@blueprintjs/core";
import { tooltipHoverOpenDelay } from "../../globals";
import styles from "./menubar.css";
-function InformationMenu(props) {
+const UndoRedo = React.memo((props) => {
const { undoDisabled, redoDisabled, dispatch } = props;
return (
@@ -46,6 +45,6 @@ function InformationMenu(props) {
);
-}
+});
-export default InformationMenu;
+export default UndoRedo;
diff --git a/client/src/components/scatterplot/scatterplot.js b/client/src/components/scatterplot/scatterplot.js
index d084faa0..43e5b0f1 100644
--- a/client/src/components/scatterplot/scatterplot.js
+++ b/client/src/components/scatterplot/scatterplot.js
@@ -117,6 +117,32 @@ class Scatterplot extends React.PureComponent {
}
);
+ computeHighlightFlags = memoize(
+ (nObs, pointDilationData, pointDilationLabel) => {
+ const flags = new Float32Array(nObs);
+ if (pointDilationData) {
+ for (let i = 0, len = flags.length; i < len; i += 1) {
+ if (pointDilationData[i] === pointDilationLabel) {
+ flags[i] = flagHighlight;
+ }
+ }
+ }
+ return flags;
+ }
+ );
+
+ computeColorByFlags = memoize((nObs, colorByData) => {
+ const flags = new Float32Array(nObs);
+ if (colorByData) {
+ for (let i = 0, len = flags.length; i < len; i += 1) {
+ if (!Number.isFinite(colorByData[i])) {
+ flags[i] = flagNaN;
+ }
+ }
+ }
+ return flags;
+ });
+
computePointFlags = memoize(
(crossfilter, colorByData, pointDilationData, pointDilationLabel) => {
/*
@@ -132,24 +158,25 @@ class Scatterplot extends React.PureComponent {
continuous metadata, as they rely on different tests, and some of the flags
(eg, isNaN) are meaningless in the face of categorical metadata.
*/
+ const nObs = crossfilter.size();
- const flags = this.computeSelectedFlags(
+ const selectedFlags = this.computeSelectedFlags(
crossfilter,
flagSelected,
0
- ).slice();
+ );
+ const highlightFlags = this.computeHighlightFlags(
+ nObs,
+ pointDilationData,
+ pointDilationLabel
+ );
+ const colorByFlags = this.computeColorByFlags(nObs, colorByData);
- if (colorByData || pointDilationData) {
- for (let i = 0, len = flags.length; i < len; i += 1) {
- if (pointDilationData) {
- flags[i] +=
- pointDilationData[i] === pointDilationLabel ? flagHighlight : 0;
- }
- if (colorByData) {
- flags[i] += Number.isFinite(colorByData[i]) ? 0 : flagNaN;
- }
- }
+ const flags = new Float32Array(nObs);
+ for (let i = 0; i < nObs; i += 1) {
+ flags[i] = selectedFlags[i] + highlightFlags[i] + colorByFlags[i];
}
+
return flags;
}
);