Skip to content

Commit 7d36ff8

Browse files
committed
add loading for fallback
1 parent 2faafb8 commit 7d36ff8

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎frontend/main/src/pages/schedule/[slug].tsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from 'next';
1111
import ScheduleUpper from '@/components/ScheduleUpper';
1212
import ScheduleCard from '@/components/ScheduleCard';
1313
import DefaultErrorPage from 'next/error';
14+
import AJLoading from '@/components/global/icons/AJLoading';
15+
import { useRouter } from 'next/router';
1416

1517
interface StaticParams {
1618
site: Site;
@@ -70,6 +72,17 @@ export default function SchedulePage({
7072
site,
7173
post,
7274
}: InferGetStaticPropsType<typeof getStaticProps>) {
75+
const router = useRouter();
76+
if (router.isFallback) {
77+
return (
78+
<Layout site={site}>
79+
<section className="max-w-md p-10 mx-auto">
80+
<h1>Loading...</h1>
81+
<AJLoading className="w-full h-auto" />
82+
</section>
83+
</Layout>
84+
);
85+
}
7386
if (!post) {
7487
return (
7588
<Layout site={site}>

0 commit comments

Comments
 (0)