Skip to content

Commit af3a5b5

Browse files
rickstaaclaude
andcommitted
refactor: simplify skeleton loading and OrchestratorList rendering
Inline ConnectButton skeleton directly in the dynamic() loading callback to prevent CLS during hydration. Simplify OrchestratorList rendering in pages/index.tsx by removing the showOrchList state, requestAnimationFrame deferral, and Spinner wrapper — data is always available from getStaticProps so these loading states were never shown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3529620 commit af3a5b5

2 files changed

Lines changed: 17 additions & 31 deletions

File tree

layouts/main.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ const DesignSystemProviderTyped = DesignSystemProvider as React.FC<{
110110

111111
const ConnectButton = dynamic(() => import("../components/ConnectButton"), {
112112
ssr: false,
113+
loading: () => (
114+
<Skeleton
115+
css={{
116+
height: "40px",
117+
minWidth: "145px",
118+
width: "145px",
119+
borderRadius: "8px",
120+
display: "inline-block",
121+
}}
122+
/>
123+
),
113124
});
114125

115126
const Claim = dynamic(() => import("../components/Claim"), { ssr: false });

pages/index.tsx

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { Group } from "@components/ExplorerChart";
55
import ExplorerChart from "@components/ExplorerChart";
66
import OrchestratorList from "@components/OrchestratorList";
77
import RoundStatus from "@components/RoundStatus";
8-
import Spinner from "@components/Spinner";
98
import TransactionsList, {
109
FILTERED_EVENT_TYPENAMES,
1110
} from "@components/TransactionsList";
@@ -23,7 +22,7 @@ import {
2322
import { ArrowRightIcon } from "@modulz/radix-icons";
2423
import { useChartData } from "hooks";
2524
import Link from "next/link";
26-
import { useCallback, useEffect, useMemo, useState } from "react";
25+
import { useCallback, useMemo, useState } from "react";
2726

2827
import {
2928
EventsQueryResult,
@@ -255,14 +254,6 @@ type PageProps = {
255254
};
256255

257256
const Home = ({ hadError, orchestrators, events, protocol }: PageProps) => {
258-
const [showOrchList, setShowOrchList] = useState(false);
259-
260-
useEffect(() => {
261-
// Let the browser paint the new route first
262-
const id = requestAnimationFrame(() => setShowOrchList(true));
263-
return () => cancelAnimationFrame(id);
264-
}, []);
265-
266257
const allEvents = useMemo(
267258
() =>
268259
events?.transactions
@@ -448,27 +439,11 @@ const Home = ({ hadError, orchestrators, events, protocol }: PageProps) => {
448439
</Flex>
449440
</Flex>
450441

451-
{!orchestrators?.transcoders || !protocol?.protocol ? (
452-
<Flex align="center" justify="center">
453-
<Spinner />
454-
</Flex>
455-
) : (
456-
<Box>
457-
{showOrchList ? (
458-
<OrchestratorList
459-
data={orchestrators?.transcoders}
460-
pageSize={10}
461-
protocolData={protocol?.protocol}
462-
/>
463-
) : (
464-
<Box
465-
css={{ padding: "$4", textAlign: "center", opacity: 0.6 }}
466-
>
467-
Loading orchestrators…
468-
</Box>
469-
)}
470-
</Box>
471-
)}
442+
<OrchestratorList
443+
data={orchestrators?.transcoders}
444+
pageSize={10}
445+
protocolData={protocol?.protocol}
446+
/>
472447

473448
<Flex
474449
css={{

0 commit comments

Comments
 (0)