Skip to content

Commit ba13733

Browse files
committed
feat: add suspense to question list
1 parent 9ea22b4 commit ba13733

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

app/(app)/challenges/_header/skeleton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Skeleton } from "@/components/ui/skeleton";
22

33
export default function HeaderSkeleton() {
44
return (
5-
<div className="flex items-center justify-between">
5+
<div className="flex items-center justify-between pb-6">
66
<div className="space-y-2">
77
<Skeleton className="h-8 w-64" />
88
<Skeleton className="h-4 w-86" />

app/(app)/challenges/content.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useDebouncedValue } from "foxact/use-debounced-value";
4-
import { useState } from "react";
4+
import { Suspense, useState } from "react";
55
import type { TagState } from "./_filter/tag";
66

77
import { Button } from "@/components/ui/button";
@@ -12,6 +12,7 @@ import FilterSection from "./_filter";
1212
import QuestionCard from "./_question";
1313
import { getQuestionSolvedStatus } from "./_question/solved-status";
1414
import type { SolvedStatus } from "./model";
15+
import { Skeleton } from "@/components/ui/skeleton";
1516

1617
export const LIST_QUESTIONS = graphql(`
1718
query ListQuestions($where: QuestionWhereInput, $after: Cursor) {
@@ -69,10 +70,12 @@ export default function ChallengePageContent() {
6970
setTags={setTags}
7071
/>
7172
<div className="flex-1">
72-
<ChallengeQuestionsList
73-
where={where}
74-
solvedStatusContains={tags.solvedStatus}
75-
/>
73+
<Suspense fallback={<Skeleton className="w-full h-48" />}>
74+
<ChallengeQuestionsList
75+
where={where}
76+
solvedStatusContains={tags.solvedStatus}
77+
/>
78+
</Suspense>
7679
</div>
7780
</div>
7881
);

0 commit comments

Comments
 (0)