fix: 홈이 실제로 가장 많이 다룬 주제를 앞에 세운다

주석은 「가장 많이 다룬 주제를 고른다」인데 목록의 첫 항목을 쓰고 있었다. 순서는 서버가
정하므로, 기록 3편짜리 주제가 18편짜리를 제치고 홈에 올랐다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-09-01 17:55:30 +09:00
co-authored by Claude Opus 5
parent 23efcf095c
commit 88d841dc96
@@ -131,9 +131,11 @@ async function getFeaturedTopic(
publicContent: PublicContentQueries,
): Promise<PublicTopicDetail | null> {
const topics = await publicContent.listTopics();
const first = topics[0];
if (!first) return null;
const detail = await publicContent.getTopicDetail(first.slug);
// 목록의 순서는 서버가 정한다. 「가장 많이 다룬」은 여기서 직접 골라야 하는 것이고,
// 첫 항목을 쓰면 기록 3편짜리 주제가 18편짜리를 제치고 홈에 오른다.
const featured = [...topics].sort((left, right) => right.recordCount - left.recordCount)[0];
if (!featured) return null;
const detail = await publicContent.getTopicDetail(featured.slug);
return detail && detail.variants.length > 1 ? detail : null;
}