Skip to content

Commit 4f93b2f

Browse files
authored
Merge pull request #533 from sparcs-kaist/feat/notice
fix: showRecent error
2 parents d7dddf6 + e0f4c9b commit 4f93b2f

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

packages/web/src/components/organisms/ChatSection.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
round,
2121
center,
2222
} from "@biseo/web/styles";
23-
import { Megaphone, ChevronDown } from "lucide-react";
23+
import { Megaphone, ChevronUp } from "lucide-react";
2424

2525
const Container = styled.div`
2626
position: relative;
@@ -60,7 +60,6 @@ export const ChatSection: React.FC = () => {
6060
const scrollRef = useRef<HTMLDivElement>(null);
6161

6262
useEffect(() => {
63-
setShowLatest(false);
6463
scrollRef.current?.scrollTo(0, 0);
6564
if (isNotice) loadNotices().catch(console.error);
6665
else loadMore().catch(console.error);
@@ -89,14 +88,13 @@ export const ChatSection: React.FC = () => {
8988
const moreFlag = isNotice ? hasMoreNotices : hasMore;
9089

9190
const handleRecentToggle = () => {
92-
if (!showLatest && notices.length === 0) {
93-
loadNotices()
94-
.then(() => {
95-
if (notices.length > 0) setShowLatest(true);
96-
})
97-
.catch(console.error);
91+
if (!showLatest) {
92+
setShowLatest(true);
93+
if (notices.length === 0) {
94+
loadNotices().catch(console.error);
95+
}
9896
} else {
99-
setShowLatest(v => !v);
97+
setShowLatest(false);
10098
}
10199
};
102100

@@ -186,7 +184,7 @@ export const ChatSection: React.FC = () => {
186184
{notices[0].message}
187185
</p>
188186
</div>
189-
<ChevronDown
187+
<ChevronUp
190188
size={20}
191189
color={colors.gray500}
192190
style={{ cursor: "pointer" }}

packages/web/src/services/chat/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const useChatStore = create(
171171
try {
172172
await socket.emitAsync("chat.update", { id, type });
173173
} catch {
174-
console.log(Error);
174+
console.log(console.error);
175175
}
176176
},
177177
})),

0 commit comments

Comments
 (0)