Skip to content

Commit

Permalink
feat: add skeleton UI components for QuestionReplyPage, SessionPage, …
Browse files Browse the repository at this point in the history
…and route
  • Loading branch information
cjeongmin committed Jan 23, 2025
1 parent 9d4f93c commit 394b391
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
8 changes: 5 additions & 3 deletions apps/client/src/pages/session/ui/QuestionReplyPage.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import React, { Suspense } from 'react';

import { ReplyListSkeletonUI } from '@/widgets/reply-list';

const LazyQuestionReplyPage = React.lazy(() =>
import('@/widgets/reply-list').then((module) => ({ default: module.ReplyList })),
);

function QuestionReplyPage() {
return (
<React.Suspense fallback={null}>
<Suspense fallback={<ReplyListSkeletonUI />}>
<LazyQuestionReplyPage />
</React.Suspense>
</Suspense>
);
}

Expand Down
11 changes: 8 additions & 3 deletions apps/client/src/pages/session/ui/SessionPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect } from 'react';
import React from 'react';
import React, { Suspense, useEffect } from 'react';

import { QuestionListSkeletonUI } from '@/widgets/question-list';

import { useSessionStore } from '@/entities/session';

Expand All @@ -16,7 +17,11 @@ function SessionPage() {
}
}, [sessionTitle]);

return <LazyQuestionList />;
return (
<Suspense fallback={<QuestionListSkeletonUI />}>
<LazyQuestionList />
</Suspense>
);
}

export default SessionPage;
8 changes: 6 additions & 2 deletions apps/client/src/routes/session/route.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { createFileRoute, Outlet, redirect, ScrollRestoration } from '@tanstack/react-router';
import React from 'react';
import React, { Suspense } from 'react';

import { ChattingListSkeletonUI } from '@/widgets/chatting-list';

import { SocketProvider } from '@/features/socket';

Expand All @@ -16,7 +18,9 @@ export const Route = createFileRoute('/session')({
<SocketProvider>
<ScrollRestoration />
<Outlet />
<LazyChattingList />
<Suspense fallback={<ChattingListSkeletonUI />}>
<LazyChattingList />
</Suspense>
</SocketProvider>
</div>
),
Expand Down

0 comments on commit 394b391

Please sign in to comment.