File tree Expand file tree Collapse file tree
packages/vscode/src/views/panel/frontend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { post_message } from '../utils/post_message'
1818import { Configurations as UiConfigurations } from '@ui/components/editor/panel/Configurations'
1919
2020type Props = {
21+ scroll_reset_key : number
2122 response_history : {
2223 response : string
2324 raw_instructions ?: string
@@ -628,6 +629,7 @@ export const Main: React.FC<Props> = (props) => {
628629
629630 return (
630631 < MainView
632+ scroll_reset_key = { props . scroll_reset_key }
631633 on_show_home = { props . on_show_home }
632634 initialize_chats = { handle_initialize_chats }
633635 copy_to_clipboard = { handle_copy_to_clipboard }
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import { IconButton as UiIconButton } from '@ui/components/editor/panel/IconButt
2828dayjs . extend ( relativeTime )
2929
3030type Props = {
31+ scroll_reset_key : number
3132 initialize_chats : ( params : {
3233 preset_name ?: string
3334 group_name ?: string
@@ -261,7 +262,9 @@ export const MainView: React.FC<Props> = (props) => {
261262 </ >
262263 )
263264
264- const scroll_to_top_key = `${ props . home_view_type } -${
265+ const scroll_to_top_key = `${ props . scroll_reset_key } -${
266+ props . home_view_type
267+ } -${
265268 props . home_view_type == HOME_VIEW_TYPES . WEB
266269 ? props . web_mode
267270 : props . api_mode
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ type ResponseHistoryItem = {
3434
3535export const Panel = ( ) => {
3636 const [ active_view , set_active_view ] = useState < 'home' | 'main' > ( 'home' )
37+ const [ main_view_scroll_reset_key , set_main_view_scroll_reset_key ] =
38+ useState ( 0 )
3739 const [ version , set_version ] = useState < string > ( '' )
3840 const [ updating_preset , set_updating_preset ] = useState < Preset > ( )
3941 const [ files_to_review , set_files_to_review ] =
@@ -364,6 +366,7 @@ export const Panel = () => {
364366 } ) }
365367 >
366368 < Main
369+ scroll_reset_key = { main_view_scroll_reset_key }
367370 vscode = { vscode }
368371 on_preset_edit = { ( preset ) => {
369372 post_message ( vscode , {
@@ -410,12 +413,14 @@ export const Panel = () => {
410413 is_active = { active_view == 'home' }
411414 on_new_chat = { ( ) => {
412415 set_active_view ( 'main' )
416+ set_main_view_scroll_reset_key ( ( k ) => k + 1 )
413417 handle_home_view_type_change ( HOME_VIEW_TYPES . WEB )
414418 handle_web_mode_change ( 'edit-context' )
415419 set_chat_input_focus_and_select_key ( ( k ) => k + 1 )
416420 } }
417421 on_api_call = { ( ) => {
418422 set_active_view ( 'main' )
423+ set_main_view_scroll_reset_key ( ( k ) => k + 1 )
419424 handle_home_view_type_change ( HOME_VIEW_TYPES . API )
420425 handle_api_mode_change ( 'edit-context' )
421426 set_chat_input_focus_and_select_key ( ( k ) => k + 1 )
You can’t perform that action at this time.
0 commit comments