Fixed realtime chart rendering of initial payload.

This commit is contained in:
Mike Cao 2023-12-09 01:41:07 -08:00
parent c520a329d2
commit 7a5f28870f

View File

@ -38,6 +38,9 @@ export function Realtime({ websiteId }) {
useEffect(() => {
if (data) {
if (!currentData) {
setCurrentData(data);
} else {
const date = subMinutes(startOfMinute(new Date()), REALTIME_RANGE);
const time = date.getTime();
@ -48,6 +51,7 @@ export function Realtime({ websiteId }) {
timestamp: data.timestamp,
}));
}
}
}, [data]);
const realtimeData: RealtimeData = useMemo(() => {