Skip to content

Commit ee60744

Browse files
committed
fix(ui): prevent flash of default values on initial load
Return null from App component until both configurationData and monitorsData are loaded, avoiding the brief flash of '0 of 0 services' and default title that appeared after Suspense was removed in 64d3649.
1 parent 9b98540 commit ee60744

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • src/ts/deucalion-ui/src/components

‎src/ts/deucalion-ui/src/components/app.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { EMPTY_MONITORS } from "../services";
21
import { Overview, MonitorList } from "./main";
32

43
import { logger } from "../services";
@@ -24,11 +23,14 @@ export const App = () => {
2423
const { monitorsData, groupedMonitorsData, usingImages } = useMonitors();
2524
const { isConnected, isConnecting, connectionError } = useMonitorHubContext();
2625

26+
// Don't render until initial data is loaded (avoids flash of default values).
27+
if (!configurationData || !monitorsData) return null;
28+
2729
return (
2830
<main className="container mx-auto max-w-6xl flex-grow p-2">
2931
<Overview
30-
title={configurationData?.pageTitle ?? "Deucalion Status"}
31-
monitors={monitorsData ?? EMPTY_MONITORS}
32+
title={configurationData.pageTitle ?? "Deucalion Status"}
33+
monitors={monitorsData}
3234
isConnected={isConnected}
3335
isConnecting={isConnecting}
3436
connectionError={connectionError}

0 commit comments

Comments
 (0)