Skip to content

Commit 9c1f40e

Browse files
authored
Merge pull request #279 from manNomi/fix/qa-bug
Refactor : 커뮤니티 페이지 토글 버튼 버그 , 리스트 순서 버그 수정
2 parents e79ab2b + e84c962 commit 9c1f40e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/api/boards/clients/useGetPostList.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ const useGetPostList = ({ boardCode, category = null }: UseGetPostListProps) =>
2727
// staleTime을 무한으로 설정하여 불필요한 자동 refetch를 방지합니다.
2828
staleTime: Infinity,
2929
gcTime: 1000 * 60 * 30, // 예: 30분
30-
select: (response) => response.data, // response.data가 실제 ListPost[]
30+
select: (response) => {
31+
return [...response.data].sort((a, b) => {
32+
return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime();
33+
});
34+
},
3135
});
3236
};
3337

src/app/community/[boardCode]/CommunityPageContent.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ const CommunityPageContent = ({ boardCode }: CommunityPageContentProps) => {
3131
router.push(`/community/${boardCode}/create`);
3232
};
3333

34+
const getBoardNameKo = (code: string) => {
35+
return COMMUNITY_BOARDS.find((board) => board.code === code)?.nameKo ?? "";
36+
};
37+
const boardName = getBoardNameKo(boardCode);
38+
3439
return (
3540
<div>
36-
<CommunityRegionSelector curRegion={"전체"} setCurRegion={handleBoardChange} regionChoices={COMMUNITY_BOARDS} />
41+
<CommunityRegionSelector
42+
curRegion={boardName}
43+
setCurRegion={handleBoardChange}
44+
regionChoices={COMMUNITY_BOARDS}
45+
/>
3746
<ButtonTab
3847
choices={COMMUNITY_CATEGORIES}
3948
choice={category}

0 commit comments

Comments
 (0)