fix(beszel): don't clear live data on transient connection errors

Keep showing existing charts during brief WebSocket reconnections
instead of flashing the error UI. The error state only shows when
no data was ever received (genuine initial connection failure).
This commit is contained in:
Thomas Camlong committed 2026-06-15 16:57:35 +02:00
1 parent 4857b72804
commit 4a65d2ae87
2 files changed
+40 -41

No files matched your search

+40 -40
View File
@@ -51,47 +51,47 @@ type BeszelAreaChartProps = Omit<AreaChartProps, "dataKey" | "curveType" | "with
yAxisDomain?: [number, string]; yAxisDomain?: [number, string];
}; };
const BeszelAreaChart = memo( const BeszelAreaChart = memo(({
({ yAxisFormatter,
yAxisFormatter, yAxisDomain,
yAxisDomain, yAxisProps: yAxisPropsOverride,
yAxisProps: yAxisPropsOverride, type = "default",
type = "default", ...props
...props }: BeszelAreaChartProps) => {
}: BeszelAreaChartProps) => { const mergedYAxis = useMemo(
const mergedYAxis = useMemo( () => ({
() => ({ ...yAxisBase,
...yAxisBase, width: 48,
width: 32, tickMargin: 2,
tickMargin: 2, ...(yAxisDomain ? { domain: yAxisDomain } : {}),
...(yAxisDomain ? { domain: yAxisDomain } : {}), tickFormatter: yAxisFormatter,
tickFormatter: yAxisFormatter, ...yAxisPropsOverride,
...yAxisPropsOverride, }),
}), [yAxisFormatter, yAxisDomain, yAxisPropsOverride],
[yAxisFormatter, yAxisDomain, yAxisPropsOverride], );
);
return ( return (
<AreaChart <AreaChart
dataKey="time" dataKey="time"
curveType="monotone" curveType="monotone"
withGradient={false} withGradient={false}
connectNulls connectNulls
withDots={false} withDots={false}
type={type} type={type}
strokeWidth={1} strokeWidth={1}
fillOpacity={0.2} fillOpacity={0.2}
areaChartProps={noAnimation} areaChartProps={{
withXAxis // margin: { top: 0, right: 0, bottom: 0, left: 10 },
withYAxis }}
w="100%" withXAxis
style={chartStyle} withYAxis
yAxisProps={mergedYAxis} w="100%"
{...props} style={chartStyle}
/> yAxisProps={mergedYAxis}
); {...props}
}, />
); );
});
export const useSystemChartData = ( export const useSystemChartData = (
systemStats: BeszelSystemStatsRecord[] | undefined, systemStats: BeszelSystemStatsRecord[] | undefined,
@@ -37,7 +37,6 @@ export const useLiveStats = (integrationIds: string[], systemId: string, enabled
); );
const onError = useCallback((err: unknown) => { const onError = useCallback((err: unknown) => {
setData(null);
setError(err instanceof Error ? err : new Error(String(err))); setError(err instanceof Error ? err : new Error(String(err)));
}, []); }, []);