mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix(chat): ensure edit area scrolls into view and clear timeout to avoid leaks
This commit is contained in:
parent
b28edaba02
commit
e0c5248a0f
1 changed files with 15 additions and 8 deletions
|
|
@ -168,14 +168,21 @@ export const ChatRowContent = ({
|
|||
|
||||
// Scroll to edit area when entering edit mode
|
||||
useEffect(() => {
|
||||
if (isEditing && editAreaRef.current) {
|
||||
// Use a small delay to ensure the DOM has updated
|
||||
setTimeout(() => {
|
||||
editAreaRef.current?.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center",
|
||||
})
|
||||
}, 100)
|
||||
if (!isEditing) return
|
||||
|
||||
let cancelled = false
|
||||
const timeoutId = window.setTimeout(() => {
|
||||
if (cancelled) return
|
||||
editAreaRef.current?.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center",
|
||||
inline: "nearest",
|
||||
})
|
||||
}, 100)
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
window.clearTimeout(timeoutId)
|
||||
}
|
||||
}, [isEditing])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue