diff --git a/apps/web/src/api/hooks.ts b/apps/web/src/api/hooks.ts
index f7b096d3..6857fd41 100644
--- a/apps/web/src/api/hooks.ts
+++ b/apps/web/src/api/hooks.ts
@@ -146,6 +146,7 @@ export function useMatchesPage(
auth: 'none',
}),
enabled: Boolean(communityId),
+ placeholderData: (previousData) => previousData,
});
}
diff --git a/apps/web/src/pages/HomePage.tsx b/apps/web/src/pages/HomePage.tsx
index 0c1aafe6..fb0145b7 100644
--- a/apps/web/src/pages/HomePage.tsx
+++ b/apps/web/src/pages/HomePage.tsx
@@ -19,9 +19,74 @@ function SkeletonBlock({ className }: { className: string }) {
);
}
+function HistoryRecordsSkeleton() {
+ const historySkeletons = Array.from({ length: 5 });
+
+ return (
+ <>
+
+
+
+
+ {['날짜', '내전', '상태', '맵', '참가', '결과'].map((label) => (
+ |
+
+ |
+ ))}
+
+
+
+ {historySkeletons.map((_, index) => (
+
+ |
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ ))}
+
+
+
+
+ {historySkeletons.map((_, index) => (
+
+ ))}
+
+ >
+ );
+}
+
function HomePageSkeleton() {
const upcomingSkeletons = Array.from({ length: UPCOMING_GRID_MATCH_LIMIT });
- const historySkeletons = Array.from({ length: 5 });
return (
-
-
-
-
- {['날짜', '내전', '상태', '맵', '참가', '결과'].map((label) => (
- |
-
- |
- ))}
-
-
-
- {historySkeletons.map((_, index) => (
-
- |
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
-
- |
-
- ))}
-
-
-
-
- {historySkeletons.map((_, index) => (
-
- ))}
-
+
);
@@ -305,11 +314,11 @@ export default function HomePage() {
);
}
- if (upcomingMatchesQuery.isLoading || historyMatchesQuery.isLoading) {
+ if (upcomingMatchesQuery.isLoading) {
return ;
}
- if (upcomingMatchesQuery.error || historyMatchesQuery.error) {
+ if (upcomingMatchesQuery.error) {
return (
@@ -329,11 +338,15 @@ export default function HomePage() {
const historyTotal = historyMatchesQuery.data?.total ?? 0;
const historyLimit =
historyMatchesQuery.data?.limit ?? HISTORY_MATCH_PAGE_SIZE;
- const historyPageFromApi = historyMatchesQuery.data?.page ?? historyPage;
const historyPageCount = Math.max(
1,
Math.ceil(historyTotal / historyLimit),
);
+ const isHistoryPageLoading =
+ historyMatchesQuery.isLoading ||
+ (historyMatchesQuery.isFetching && historyMatchesQuery.isPlaceholderData);
+ const hasHistoryError =
+ Boolean(historyMatchesQuery.error) && !historyMatchesQuery.data;
const goToPreviousHistoryPage = () =>
setHistoryPage((page) => Math.max(1, page - 1));
const goToNextHistoryPage = () => setHistoryPage((page) => page + 1);
@@ -451,116 +464,135 @@ export default function HomePage() {
-
+
지난 내전 기록
- {/* 데스크톱: 테이블 */}
-
-
-
-
- | 날짜 |
- 내전 |
- 상태 |
- 맵 |
- 참가 |
- 결과 |
-
-
-
- {historyMatches.length > 0 ? (
- historyMatches.map((match) => (
-
- |
- {match.date}
- |
-
-
- {match.title}
-
- |
-
-
- |
-
-
- |
-
- {match.participants.length}명
- |
-
- {match.result?.winner ? `${match.result.winner} 승리` : '-'}
- |
+ {isHistoryPageLoading ? (
+
+ ) : hasHistoryError ? (
+
+ 지난 내전 기록을 불러오지 못했습니다.
+
+ ) : (
+ <>
+ {/* 데스크톱: 테이블 */}
+
+
+
+
+ | 날짜 |
+ 내전 |
+ 상태 |
+ 맵 |
+ 참가 |
+ 결과 |
- ))
- ) : (
-
- |
- 아직 내전 기록이 없습니다.
- |
-
- )}
-
-
-
-
- {/* 모바일: 카드 리스트 */}
-
- {historyMatches.length > 0 ? (
- historyMatches.map((match) => {
- const resultLabel = match.result?.winner
- ? `${match.result.winner} 승리`
- : undefined;
-
- return (
-
-
-
-
- {match.compactDateTime || `${match.date} ${match.time}`}
-
-
- {match.title}
-
-
-
-
-
-
-
-
-
-
- );
- })
- ) : (
-
- 아직 내전 기록이 없습니다.
+
+
+ {historyMatches.length > 0 ? (
+ historyMatches.map((match) => (
+
+ |
+ {match.date}
+ |
+
+
+ {match.title}
+
+ |
+
+
+ |
+
+
+ |
+
+ {match.participants.length}명
+ |
+
+ {match.result?.winner
+ ? `${match.result.winner} 승리`
+ : '-'}
+ |
+
+ ))
+ ) : (
+
+ |
+ 아직 내전 기록이 없습니다.
+ |
+
+ )}
+
+
- )}
-
- {historyTotal > 0 && (
+
+ {/* 모바일: 카드 리스트 */}
+
+ {historyMatches.length > 0 ? (
+ historyMatches.map((match) => {
+ const resultLabel = match.result?.winner
+ ? `${match.result.winner} 승리`
+ : undefined;
+
+ return (
+
+
+
+
+ {match.compactDateTime ||
+ `${match.date} ${match.time}`}
+
+
+ {match.title}
+
+
+
+
+
+
+
+
+
+
+ );
+ })
+ ) : (
+
+ 아직 내전 기록이 없습니다.
+
+ )}
+
+ >
+ )}
+ {!hasHistoryError && historyTotal > 0 && (