Skip to content

Commit

Permalink
refactor: rename dialogueEndRef to targetEndRef in useScrollToBottom …
Browse files Browse the repository at this point in the history
…hook
  • Loading branch information
yuiseki committed Nov 9, 2024
1 parent ed7fcc8 commit 50838cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/hooks/scrollToBottom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { sleep } from "@/utils/sleep";
import { useCallback, RefObject } from "react";

export const useScrollToBottom = (
dialogueEndRef: RefObject<HTMLDivElement>
targetEndRef: RefObject<HTMLDivElement>
) => {
const scrollToBottom = useCallback(async () => {
await sleep(50);
if (dialogueEndRef.current) {
dialogueEndRef.current.scrollIntoView({ behavior: "instant" });
if (targetEndRef.current) {
targetEndRef.current.scrollIntoView({ behavior: "instant" });
}
}, [dialogueEndRef]);
}, [targetEndRef]);

return scrollToBottom;
};

0 comments on commit 50838cc

Please sign in to comment.