Spaces:
Running
Running
fix(ui): use native div for chat scroll to fix scrollIntoView bug
Browse filesReplaced shadcn ScrollArea with a native overflow-y-auto div in ChatPanel.
The custom scroll area viewport frequently intercepts or fails to trigger
native DOM scrollIntoView() events during React renders, causing the chat
to get stuck instead of auto-scrolling to the bottom.
frontend/src/components/chat/ChatPanel.tsx
CHANGED
|
@@ -3,7 +3,6 @@
|
|
| 3 |
import { useState, useRef, useEffect } from "react";
|
| 4 |
import type { DocInfo } from "@/app/dashboard/page";
|
| 5 |
import { api } from "@/lib/api";
|
| 6 |
-
import { ScrollArea } from "@/components/ui/scroll-area";
|
| 7 |
import { Button } from "@/components/ui/button";
|
| 8 |
import { Textarea } from "@/components/ui/textarea";
|
| 9 |
import MessageBubble from "./MessageBubble";
|
|
@@ -205,7 +204,7 @@ export default function ChatPanel({ activeDoc, onCitationClick }: Props) {
|
|
| 205 |
return (
|
| 206 |
<div className="h-full flex flex-col">
|
| 207 |
{/* ββ Chat Messages ββββββββββββββββββββββββββββ */}
|
| 208 |
-
<
|
| 209 |
{messages.length === 0 ? (
|
| 210 |
<div className="h-full flex flex-col items-center justify-center py-20">
|
| 211 |
<div className="w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mb-4">
|
|
@@ -234,9 +233,8 @@ export default function ChatPanel({ activeDoc, onCitationClick }: Props) {
|
|
| 234 |
))}
|
| 235 |
</div>
|
| 236 |
)}
|
| 237 |
-
{
|
| 238 |
-
|
| 239 |
-
</ScrollArea>
|
| 240 |
|
| 241 |
{/* ββ Input Area βββββββββββββββββββββββββββββββ */}
|
| 242 |
<div className="border-t border-border/50 p-4 bg-card/30 backdrop-blur-sm">
|
|
|
|
| 3 |
import { useState, useRef, useEffect } from "react";
|
| 4 |
import type { DocInfo } from "@/app/dashboard/page";
|
| 5 |
import { api } from "@/lib/api";
|
|
|
|
| 6 |
import { Button } from "@/components/ui/button";
|
| 7 |
import { Textarea } from "@/components/ui/textarea";
|
| 8 |
import MessageBubble from "./MessageBubble";
|
|
|
|
| 204 |
return (
|
| 205 |
<div className="h-full flex flex-col">
|
| 206 |
{/* ββ Chat Messages ββββββββββββββββββββββββββββ */}
|
| 207 |
+
<div className="flex-1 px-4 overflow-y-auto custom-scrollbar">
|
| 208 |
{messages.length === 0 ? (
|
| 209 |
<div className="h-full flex flex-col items-center justify-center py-20">
|
| 210 |
<div className="w-16 h-16 rounded-2xl bg-primary/10 flex items-center justify-center mb-4">
|
|
|
|
| 233 |
))}
|
| 234 |
</div>
|
| 235 |
)}
|
| 236 |
+
<div ref={bottomRef} className="h-4" />
|
| 237 |
+
</div>
|
|
|
|
| 238 |
|
| 239 |
{/* ββ Input Area βββββββββββββββββββββββββββββββ */}
|
| 240 |
<div className="border-t border-border/50 p-4 bg-card/30 backdrop-blur-sm">
|