Skip to content

Commit

Permalink
feat: add loading.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwitzko committed Oct 16, 2023
1 parent 84ecb60 commit 8fd94fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
13 changes: 13 additions & 0 deletions app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Flex, Text } from "@radix-ui/themes";

import style from "@/app/layout.module.css";

export default function Loading() {
return (
<Flex align="center" justify="center" className={style.loading}>
<Text color="gray" weight="light">
Loading...
</Text>
</Flex>
);
}
18 changes: 1 addition & 17 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
import { Flex, Text } from "@radix-ui/themes";
import { Suspense } from "react";

import { getAllPlugins } from "@/lib/registry";

import { PluginOverview } from "./client";
import style from "./layout.module.css";

export const revalidate = 300;

function Loading() {
return (
<Flex align="center" justify="center" className={style.loading}>
<Text>Loading...</Text>
</Flex>
);
}

export default async function Home() {
const plugins = await getAllPlugins();
plugins.sort((a, b) => a.FullName.localeCompare(b.FullName));
return (
<Suspense fallback={<Loading />}>
<PluginOverview plugins={plugins} />
</Suspense>
);
return <PluginOverview plugins={plugins} />;
}

0 comments on commit 8fd94fe

Please sign in to comment.