fix(beszel): address review findings for live streaming

- Skip toReversed() for live data (already chronological from buffer)
- Reset live buffer on systemId/integration change to avoid stale data
- Throw on unexpected SSE stream end so subscription emits error
- Delete unused time-period.ts config (duplicate of server-side config)
This commit is contained in:
Thomas Camlong committed 2026-06-15 15:15:06 +02:00
1 parent 7e46c71187
commit d13effdda0
4 files changed
+19 -23

No files matched your search

@@ -83,7 +83,8 @@ export const useSystemChartData = (
useMemo(() => {
if (!systemStats) return [];
const fmt = live ? formatTimeLive : formatTime;
return [...systemStats].toReversed().map((r) => ({
const ordered = live ? systemStats : [...systemStats].toReversed();
return ordered.map((r) => ({
time: fmt(r.created),
...mapFn(r.stats),
}));
@@ -123,7 +124,8 @@ export const useDockerChartData = (
const extract = defaultContainerExtractors[metric];
if (!extract) return [];
const fmt = live ? formatTimeLive : formatTime;
return [...containerStats].toReversed().map((record) => {
const ordered = live ? containerStats : [...containerStats].toReversed();
return ordered.map((record) => {
const point: Record<string, unknown> = { time: fmt(record.created) };
for (const name of containerNames) {
point[name] = extract(record.stats.find((c) => c.n === name));