fix(beszel): improve live subscription error handling and cleanup
- Surface subscription errors in useLiveStats via onError + error state - Show error UI in live mode when SSE connection fails - Abort SSE reader on subscribeTopic failure instead of silent log - Guard mock realtime against pre-aborted signal to prevent interval leak - Remove dead includeDocker from subscription input schema
This commit is contained in:
5 files changed
+28
-7
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { ActionIcon, Center, Menu, ScrollArea, Select, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { IconServer, IconQuestionMark } from "@tabler/icons-react";
|
||||
import { IconPlugConnectedX, IconServer, IconQuestionMark } from "@tabler/icons-react";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useScopedI18n } from "@homarr/translation/client";
|
||||
@@ -77,7 +77,7 @@ export default function BeszelSystemStatsWidget({
|
||||
{ staleTime: 30 * 1000, enabled: !isLive && systemReady && selectedSystem !== "" },
|
||||
);
|
||||
|
||||
const liveData = useLiveStats(integrationIds, selectedSystem, isLive && systemReady);
|
||||
const { data: liveData, error: liveError } = useLiveStats(integrationIds, selectedSystem, isLive && systemReady);
|
||||
|
||||
const activeStats = isLive ? liveData : statsResult;
|
||||
|
||||
@@ -142,6 +142,19 @@ export default function BeszelSystemStatsWidget({
|
||||
);
|
||||
}
|
||||
|
||||
if (isLive && liveError && !liveData) {
|
||||
return (
|
||||
<Center h="100%">
|
||||
<Stack align="center" gap="sm" p="md">
|
||||
<IconPlugConnectedX size={40} />
|
||||
<Text size="sm" c="dimmed" ta="center">
|
||||
{t("error.internalServerError")}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Center>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollArea
|
||||
h="100%"
|
||||
|
||||
Reference in new issue
Block a user