@@ -400,27 +400,25 @@ export class Remote {
400400 let hasShownOutdatedNotification = false
401401 const refreshWorkspaceUpdatedStatus = ( newWorkspace : Workspace ) => {
402402 // If the newly gotten workspace was updated, then we show a notification
403- // to the user that they should update.
404- if ( newWorkspace . outdated ) {
405- if ( ! workspace . outdated || ! hasShownOutdatedNotification ) {
406- hasShownOutdatedNotification = true
407- workspaceRestClient
408- . getTemplate ( newWorkspace . template_id )
409- . then ( ( template ) => {
410- return workspaceRestClient . getTemplateVersion ( template . active_version_id )
411- } )
412- . then ( ( version ) => {
413- let infoMessage = `A new version of your workspace is available.`
414- if ( version . message ) {
415- infoMessage = `A new version of your workspace is available: ${ version . message } `
403+ // to the user that they should update. Only show this once per session.
404+ if ( newWorkspace . outdated && ! hasShownOutdatedNotification ) {
405+ hasShownOutdatedNotification = true
406+ workspaceRestClient
407+ . getTemplate ( newWorkspace . template_id )
408+ . then ( ( template ) => {
409+ return workspaceRestClient . getTemplateVersion ( template . active_version_id )
410+ } )
411+ . then ( ( version ) => {
412+ let infoMessage = `A new version of your workspace is available.`
413+ if ( version . message ) {
414+ infoMessage = `A new version of your workspace is available: ${ version . message } `
415+ }
416+ vscode . window . showInformationMessage ( infoMessage , "Update" ) . then ( ( action ) => {
417+ if ( action === "Update" ) {
418+ vscode . commands . executeCommand ( "coder.workspace.update" , newWorkspace , workspaceRestClient )
416419 }
417- vscode . window . showInformationMessage ( infoMessage , "Update" ) . then ( ( action ) => {
418- if ( action === "Update" ) {
419- vscode . commands . executeCommand ( "coder.workspace.update" , newWorkspace , workspaceRestClient )
420- }
421- } )
422420 } )
423- }
421+ } )
424422 }
425423 if ( ! newWorkspace . outdated ) {
426424 vscode . commands . executeCommand ( "setContext" , "coder.workspace.updatable" , false )
0 commit comments