mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +01:00
Fixed realtime chart rendering of initial payload.
This commit is contained in:
parent
c520a329d2
commit
7a5f28870f
@ -38,15 +38,19 @@ export function Realtime({ websiteId }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data) {
|
if (data) {
|
||||||
const date = subMinutes(startOfMinute(new Date()), REALTIME_RANGE);
|
if (!currentData) {
|
||||||
const time = date.getTime();
|
setCurrentData(data);
|
||||||
|
} else {
|
||||||
|
const date = subMinutes(startOfMinute(new Date()), REALTIME_RANGE);
|
||||||
|
const time = date.getTime();
|
||||||
|
|
||||||
setCurrentData(state => ({
|
setCurrentData(state => ({
|
||||||
pageviews: mergeData(state?.pageviews, data.pageviews, time),
|
pageviews: mergeData(state?.pageviews, data.pageviews, time),
|
||||||
sessions: mergeData(state?.sessions, data.sessions, time),
|
sessions: mergeData(state?.sessions, data.sessions, time),
|
||||||
events: mergeData(state?.events, data.events, time),
|
events: mergeData(state?.events, data.events, time),
|
||||||
timestamp: data.timestamp,
|
timestamp: data.timestamp,
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user