1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Updating Chart on every componentDidUpdate

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-08-25 16:40:58 +03:00
parent 29e7051a32
commit c0d4169cf0

View File

@ -63,14 +63,14 @@ export class Chart extends React.Component<ChartProps> {
this.renderChart()
}
componentDidUpdate(prevProps: ChartProps) {
const { data, showChart, redraw } = this.props
componentDidUpdate() {
const { showChart, redraw } = this.props
if (redraw) {
this.chart.destroy()
this.renderChart()
return
}
if (!isEqual(prevProps.data, data) && showChart) {
if (showChart) {
if (!this.chart) this.renderChart()
else this.updateChart()
}