glitch fix attempt

This commit is contained in:
JalleliAchraf committed 2026-02-18 10:07:43 +01:00
1 parent 88b0c87a51
commit 658f524eff
1 file changed
+10 -3
+10 -3
View File
@@ -91,8 +91,13 @@ export function useLiveMode({
const hasDashedHistoricalTargets = hasHistoricalDashedTargets(config);
const [timestamps, values] = seriesToUPlotData(primaryData.long);
const cur = primaryData.current;
const liveTimestamps = [...timestamps, cur.timestamp];
const liveValues = [...values, cur.value];
const lastHistoricalTimestamp =
timestamps[timestamps.length - 1] ?? cur.timestamp;
const shouldAppendCurrent = cur.timestamp > lastHistoricalTimestamp;
const liveTimestamps = shouldAppendCurrent
? [...timestamps, cur.timestamp]
: timestamps;
const liveValues = shouldAppendCurrent ? [...values, cur.value] : values;
const allSeriesValues = getAllSeriesData(newData);
const normalized = normalizeDataSeries(newData);
@@ -108,7 +113,9 @@ export function useLiveMode({
(seriesValues.length > 0
? seriesValues[seriesValues.length - 1]
: 0);
return [...seriesValues, currentValue];
return shouldAppendCurrent
? [...seriesValues, currentValue]
: seriesValues;
})
: [];