6
6
import { type Site , type SiteConfig , type SiteSourceControl , type StringDictionary } from "@azure/arm-appservice" ;
7
7
import { DeleteLastServicePlanStep , DeleteSiteStep , DeploymentTreeItem , DeploymentsTreeItem , LogFilesTreeItem , ParsedSite , SiteFilesTreeItem , createWebSiteClient , getFile , type IDeleteSiteWizardContext } from "@microsoft/vscode-azext-azureappservice" ;
8
8
import { AppSettingTreeItem , AppSettingsTreeItem } from "@microsoft/vscode-azext-azureappsettings" ;
9
- import { AzureWizard , DeleteConfirmationStep , callWithTelemetryAndErrorHandling , nonNullValue , type AzExtTreeItem , type IActionContext , type ISubscriptionContext , type TreeItemIconPath } from "@microsoft/vscode-azext-utils" ;
9
+ import { AzureWizard , DeleteConfirmationStep , callWithTelemetryAndErrorHandling , type AzExtTreeItem , type IActionContext , type ISubscriptionContext , type TreeItemIconPath } from "@microsoft/vscode-azext-utils" ;
10
10
import { type ResolvedAppResourceBase } from "@microsoft/vscode-azext-utils/hostapi" ;
11
11
import { latestGAVersion , tryParseFuncVersion , type FuncVersion } from "../FuncVersion" ;
12
12
import { type FunctionAppModel } from "../FunctionAppResolver" ;
@@ -93,7 +93,6 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
93
93
const webClient = await createWebSiteClient ( { ...context , ...this . _subscription } ) ;
94
94
const rawSite = await webClient . webApps . get ( this . dataModel . resourceGroup , this . dataModel . name ) ;
95
95
this . _site = new ParsedSite ( rawSite , this . _subscription ) ;
96
- this . data = rawSite ;
97
96
this . addValuesToMask ( this . _site ) ;
98
97
}
99
98
}
@@ -104,7 +103,6 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
104
103
// try to lazy load the site if it hasn't been initialized yet
105
104
void this . initSite ( context ) ;
106
105
} ) ;
107
- // If the site is not initialized, we should throw an error
108
106
throw new Error ( localize ( 'siteNotSet' , 'Site is not initialized. Please try again in a moment.' ) ) ;
109
107
}
110
108
return this . _site ;
@@ -176,8 +174,11 @@ export class ResolvedFunctionAppResource extends ResolvedFunctionAppBase impleme
176
174
177
175
// on refresh, we should reinitialize the site to ensure we have the latest data
178
176
const client = await this . site . createClient ( context ) ;
179
- this . _site = new ParsedSite ( nonNullValue ( await client . getSite ( ) , 'site' ) , this . _subscription ) ;
180
- this . dataModel = this . createDataModelFromSite ( this . _site . rawSite ) ;
177
+ const site = await client . getSite ( ) ;
178
+ if ( site ) {
179
+ this . dataModel = this . createDataModelFromSite ( site ) ;
180
+ this . _site = new ParsedSite ( site , this . _subscription ) ;
181
+ }
181
182
}
182
183
183
184
public async getVersion ( context : IActionContext ) : Promise < FuncVersion > {
0 commit comments