Improved comment

This commit is contained in:
Alejandro Celaya 2021-09-18 12:34:14 +02:00
parent 58ee123cef
commit 382d7b1c9f

View file

@ -150,6 +150,7 @@ const DefaultChart = memo((
const chartData = generateChartData(isBarChart, labels, data, highlightedData, highlightedLabel); const chartData = generateChartData(isBarChart, labels, data, highlightedData, highlightedLabel);
const height = determineHeight(isBarChart, labels); const height = determineHeight(isBarChart, labels);
// Provide a key based on the height, to force re-render every time the dataset changes (example, due to pagination)
const renderChartComponent = (customKey: string) => ( const renderChartComponent = (customKey: string) => (
<Component <Component
ref={(element) => { ref={(element) => {
@ -163,7 +164,6 @@ const DefaultChart = memo((
/> />
); );
// Provide a key based on the height, so that every time the dataset changes, a new chart is rendered
return ( return (
<div className="row"> <div className="row">
<div className={classNames('col-sm-12', { 'col-md-7': !isBarChart })}> <div className={classNames('col-sm-12', { 'col-md-7': !isBarChart })}>