File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
webview-ui/src/components/chat Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -168,14 +168,21 @@ export const ChatRowContent = ({
168168
169169 // Scroll to edit area when entering edit mode
170170 useEffect ( ( ) => {
171- if ( isEditing && editAreaRef . current ) {
172- // Use a small delay to ensure the DOM has updated
173- setTimeout ( ( ) => {
174- editAreaRef . current ?. scrollIntoView ( {
175- behavior : "smooth" ,
176- block : "center" ,
177- } )
178- } , 100 )
171+ if ( ! isEditing ) return
172+
173+ let cancelled = false
174+ const timeoutId = window . setTimeout ( ( ) => {
175+ if ( cancelled ) return
176+ editAreaRef . current ?. scrollIntoView ( {
177+ behavior : "smooth" ,
178+ block : "center" ,
179+ inline : "nearest" ,
180+ } )
181+ } , 100 )
182+
183+ return ( ) => {
184+ cancelled = true
185+ window . clearTimeout ( timeoutId )
179186 }
180187 } , [ isEditing ] )
181188
You can’t perform that action at this time.
0 commit comments