Skip to content

Commit e5423c6

Browse files
committed
[fix] cancelanimation 추가
1 parent 7254bd1 commit e5423c6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/domains/recommend/hook/useChatScroll.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ export const useChatScroll = (lastMessageId: string) => {
2222
return;
2323
}
2424

25-
requestAnimationFrame(() => {
25+
const frameId = requestAnimationFrame(() => {
2626
chatEndRef.current?.scrollIntoView({ behavior: 'auto' });
2727
setShowNewMessageAlert(false);
2828
});
29+
30+
return () => cancelAnimationFrame(frameId);
2931
}, [lastMessageId]);
3032

3133
// 스크롤 제일 아래로

0 commit comments

Comments
 (0)