File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/prompt-view/UpdateAvailable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,19 @@ export const check_for_updates_command = (
3939 )
4040
4141 if ( action === t ( 'command.check-for-updates-command.action.update' ) ) {
42+ if ( prompt_view_provider . is_updating ) {
43+ return
44+ }
45+
4246 if ( prompt_view_provider . update_info . latest_version_tag ) {
47+ prompt_view_provider . is_updating = true
48+ prompt_view_provider . send_message ( {
49+ command : 'UPDATE_INFO' ,
50+ update_info : {
51+ ...prompt_view_provider . update_info ,
52+ is_updating : true
53+ }
54+ } )
4355 update_extension ( {
4456 tag_name : prompt_view_provider . update_info . latest_version_tag
4557 } )
Original file line number Diff line number Diff line change @@ -4,7 +4,19 @@ import { PromptViewProvider } from '../prompt-view-provider'
44export const handle_update_extension = (
55 prompt_view_provider : PromptViewProvider
66) => {
7+ if ( prompt_view_provider . is_updating ) {
8+ return
9+ }
10+
711 if ( prompt_view_provider . update_info . latest_version_tag ) {
12+ prompt_view_provider . is_updating = true
13+ prompt_view_provider . send_message ( {
14+ command : 'UPDATE_INFO' ,
15+ update_info : {
16+ ...prompt_view_provider . update_info ,
17+ is_updating : true
18+ }
19+ } )
820 update_extension ( {
921 tag_name : prompt_view_provider . update_info . latest_version_tag
1022 } )
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
8787 public agentic_search_state : AgenticSearchState
8888 public completed_tasks : string [ ] = [ ]
8989 public update_info : UpdateInfo = { is_available : false }
90+ public is_updating : boolean = false
9091
9192 // Voice input
9293 public is_recording = false
@@ -834,7 +835,10 @@ export class PromptViewProvider implements vscode.WebviewViewProvider {
834835 } else if ( message . command === 'GET_UPDATE_INFO' ) {
835836 this . send_message ( {
836837 command : 'UPDATE_INFO' ,
837- update_info : this . update_info
838+ update_info : {
839+ ...this . update_info ,
840+ is_updating : this . is_updating
841+ }
838842 } )
839843 }
840844 } catch ( error ) {
Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ export const Home: React.FC<Props> = (props) => {
165165 on_update = { ( ) =>
166166 post_message ( props . vscode , { command : 'UPDATE_EXTENSION' } )
167167 }
168+ is_updating = { props . update_info . is_updating }
168169 current_version = { props . version }
169170 latest_version = { props . update_info . latest_version }
170171 translations = { {
Original file line number Diff line number Diff line change @@ -460,6 +460,7 @@ export type UpdateInfo = {
460460 latest_version ?: string
461461 latest_version_tag ?: string
462462 current_version_age_days ?: number
463+ is_updating ?: boolean
463464}
464465
465466export interface GetUpdateInfoMessage extends BaseMessage {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import cn from 'classnames'
55
66type Props = {
77 on_update : ( ) => void
8+ is_updating ?: boolean
89 current_version : string
910 latest_version ?: string
1011 translations : {
@@ -17,6 +18,9 @@ type Props = {
1718
1819export const UpdateAvailable : React . FC < Props > = ( props ) => {
1920 const [ is_expanded , set_is_expanded ] = React . useState ( false )
21+ const [ is_updating_local , set_is_updating_local ] = React . useState ( false )
22+
23+ const is_updating = props . is_updating || is_updating_local
2024
2125 return (
2226 < div
@@ -38,9 +42,11 @@ export const UpdateAvailable: React.FC<Props> = (props) => {
3842 < Button
3943 on_click = { ( e ) => {
4044 e . stopPropagation ( )
45+ set_is_updating_local ( true )
4146 props . on_update ( )
4247 } }
4348 is_small
49+ disabled = { is_updating }
4450 >
4551 { props . translations . button }
4652 </ Button >
You can’t perform that action at this time.
0 commit comments