Skip to content

Commit 595a250

Browse files
committed
bug; dont scroll on share link
1 parent b47c126 commit 595a250

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/components/ChatWindow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface ChatWindowProps extends HeaderProps {
3131
className?: string;
3232
showDonation: boolean;
3333
fullscreen?: boolean;
34+
scrollToBottom?: boolean;
3435
}
3536

3637
const messageListId = "chat-window-message-list";
@@ -43,6 +44,7 @@ const ChatWindow = ({
4344
showDonation,
4445
onSave,
4546
fullscreen,
47+
scrollToBottom,
4648
}: ChatWindowProps) => {
4749
const [hasUserScrolled, setHasUserScrolled] = useState(false);
4850
const scrollRef = useRef<HTMLDivElement>(null);
@@ -60,7 +62,7 @@ const ChatWindow = ({
6062

6163
useEffect(() => {
6264
// Scroll to bottom on re-renders
63-
if (scrollRef && scrollRef.current) {
65+
if (scrollToBottom && scrollRef && scrollRef.current) {
6466
if (!hasUserScrolled) {
6567
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
6668
}

src/pages/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ const Home: NextPage = () => {
187187
}
188188
: undefined
189189
}
190+
scrollToBottom
190191
/>
191192
{tasks.length > 0 && <TaskWindow tasks={tasks} />}
192193
</Expand>

0 commit comments

Comments
 (0)