Open dumihi313 opened 2 months ago
this my code, I overcame by update a new timestamp to key prop (force rerender). Is there any better solution than this?
` useEffect(() => {
if (batteryChart && batteryChart.length > 0) {
const result = parseDTOtoChartModel(
batteryChart,
renderDataPointLabelComponent,
).dataSet
setDataSet(result)
savedDataSet.current = result.map(a => Object.assign({}, a))
setRenderChartWithDateKey(date) // force rerender
} else if (batteryChart) {
setDataSet(emptyChart24hDataset)
savedDataSet.current = emptyChart24hDataset.map(a =>
Object.assign({}, a),
)
setRenderChartWithDateKey(date) // force rerender
}
}, [batteryChart])`
https://github.com/user-attachments/assets/f32dc06a-9765-4764-9600-76b9651699f4
To continue with issue
When I change the dataset, it just rerenders for datapoints. It doesn't rerender to remove old line and add new line based on dataset