From 658f8dccc34c1789befe1c13589980bd13a099e1 Mon Sep 17 00:00:00 2001 From: James Hadfield Date: Tue, 9 Mar 2021 16:42:45 +1300 Subject: [PATCH] Update frequencies panel when data changes The frequencies component performed some basic comparisons between the previously rendered data and new data to avoid unnecessary re-renders. This logic was too simplistic and caused a bug where the component wouldn't re-render the graph when the data had indeed changed. This commit skips these checks. This may result in some unnecessary re-renders, however I couldn't find any in my testing. Closes #1224 --- src/components/frequencies/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/frequencies/index.js b/src/components/frequencies/index.js index b6001fc18..3aa4833fe 100644 --- a/src/components/frequencies/index.js +++ b/src/components/frequencies/index.js @@ -5,7 +5,7 @@ import 'd3-transition'; import { connect } from "react-redux"; import Card from "../framework/card"; import { calcXScale, calcYScale, drawXAxis, drawYAxis, drawProjectionInfo, - areListsEqual, drawStream, processMatrix, parseColorBy, normString } from "./functions"; + drawStream, processMatrix, parseColorBy, normString } from "./functions"; import "../../css/entropy.css"; @connect((state) => { @@ -50,8 +50,6 @@ class Frequencies extends React.Component { /* we don't have to check width / height changes here - that's done in componentDidUpdate */ const data = processMatrix({...newProps}); const maxYChange = oldState.maxY !== data.maxY; - const catChange = !areListsEqual(oldState.categories, data.categories); - if (!maxYChange && !catChange) return false; const chartGeom = this.calcChartGeom(newProps.width, newProps.height); /* should the y scale be updated? */ let newScales;