Skip to content

Commit 261e06c

Browse files
authored
Prevent welcome view flashes (#1399)
## Changes Right now if you switch to the Databricks panel (after the extension is already logged in), you will still see "Create a new Databricks Project" welcome view for half a second. This is because our main view takes this long to load all the relevant information (sync component make API request to the workspace). This PR prevents UI flashed by adding "Loading configuration" welcome view based on the isBundleProject flag. ## Tests Manual and existing tests
1 parent c1c4a43 commit 261e06c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

packages/databricks-vscode/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,11 @@
385385
]
386386
},
387387
"viewsWelcome": [
388+
{
389+
"view": "configurationView",
390+
"contents": "Initializing...",
391+
"when": "workspaceFolderCount > 0 && !databricks.context.initialized"
392+
},
388393
{
389394
"view": "configurationView",
390395
"contents": "There are multiple Databricks projects in the folder:\n[Open existing Databricks Project](command:databricks.bundle.openSubProject)",
@@ -398,12 +403,12 @@
398403
{
399404
"view": "configurationView",
400405
"contents": "[Create a new Databricks Project](command:databricks.bundle.initNewProject)",
401-
"when": "workspaceFolderCount > 0 && databricks.context.initialized"
406+
"when": "workspaceFolderCount > 0 && databricks.context.initialized && !databricks.context.isBundleProject"
402407
},
403408
{
404409
"view": "configurationView",
405-
"contents": "Initializing...",
406-
"when": "workspaceFolderCount > 0 && !databricks.context.initialized"
410+
"contents": "Loading configuration",
411+
"when": "workspaceFolderCount > 0 && databricks.context.initialized && databricks.context.isBundleProject"
407412
},
408413
{
409414
"view": "configurationView",
@@ -923,7 +928,7 @@
923928
"package:copy-webview-toolkit": "cp ./node_modules/@vscode/webview-ui-toolkit/dist/toolkit.js ./out/toolkit.js",
924929
"esbuild:base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node --sourcemap --target=es2019",
925930
"build": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && tsc --build --force",
926-
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --force",
931+
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --force --verbose",
927932
"fix": "eslint src --ext ts --fix && prettier . --write",
928933
"test:lint": "eslint src --ext ts && prettier . -c",
929934
"test:unit": "yarn run build && node ./out/test/runTest.js",

packages/databricks-vscode/src/bundle/BundleProjectManager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ export class BundleProjectManager {
114114
this.logger.debug(
115115
"Detected an existing bundle project, initializing project services"
116116
);
117+
this.customWhenContext.setIsBundleProject(true);
117118
return this.initProjectServices();
118119
} else {
119120
this.logger.debug(
120121
"No bundle config detected, disposing project services"
121122
);
123+
this.customWhenContext.setIsBundleProject(false);
122124
await this.disposeProjectServices();
123125
}
124126
}

packages/databricks-vscode/src/vscode-objs/CustomWhenContext.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export class CustomWhenContext {
4343
);
4444
}
4545

46+
setIsBundleProject(value: boolean) {
47+
commands.executeCommand(
48+
"setContext",
49+
"databricks.context.isBundleProject",
50+
value
51+
);
52+
}
53+
4654
setSubProjectsAvailable(value: boolean) {
4755
commands.executeCommand(
4856
"setContext",

0 commit comments

Comments
 (0)