Skip to content

Commit a81d676

Browse files
Fix flashing
1 parent 9a34d4a commit a81d676

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

src/cloud/commands/deploy.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export async function deploy(context: DeployContext): Promise<boolean> {
126126
}
127127

128128
try {
129+
// Set status immediately to prevent flash from config watcher triggering refresh
129130
updateStatus("Creating deployment...")
130131
const deployment = await apiService.createDeployment(config.app_id)
131132

@@ -148,6 +149,9 @@ export async function deploy(context: DeployContext): Promise<boolean> {
148149
)
149150

150151
if (result) {
152+
// Update status bar to show success before showing the message
153+
statusBarItem.text = `$(cloud) ${config.app_slug ?? "Deployed"}`
154+
151155
const action = await ui.showInformationMessage(
152156
"Deployed successfully!",
153157
"Open App",

src/cloud/controller.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,21 @@ export class CloudController {
275275
async deploy(workspaceRoot?: vscode.Uri): Promise<void> {
276276
const root = workspaceRoot ?? this.getActiveWorkspaceFolder()
277277

278-
await deploy({
278+
const success = await deploy({
279279
workspaceRoot: root,
280280
configService: this.configService,
281281
apiService: this.apiService,
282282
statusBarItem: this.statusBarItem,
283283
})
284284

285285
if (root) {
286+
// Refresh state in background without updating status bar during refresh
287+
// This avoids a flash when deploy succeeds (status bar is already correct)
286288
await this.refresh(root)
287-
await this.statusBarManager.update()
289+
// Only update status bar on failure - success already set it correctly
290+
if (!success) {
291+
await this.statusBarManager.update()
292+
}
288293
}
289294
}
290295

src/cloud/ui/statusBar.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,19 @@ export class StatusBarManager {
5959

6060
const state = this.getState(activeFolder)
6161

62+
// Don't interrupt an active deployment (spinning icon)
63+
if (this.statusBarItem.text.includes("$(sync~spin)")) {
64+
return
65+
}
66+
6267
switch (state.status) {
6368
case "not_configured":
6469
case "error":
65-
case "refreshing":
6670
this.statusBarItem.text = STATUS_DEPLOY
6771
break
72+
case "refreshing":
73+
// Don't change status bar during refresh to avoid flashing
74+
break
6875
case "linked":
6976
this.statusBarItem.text = `$(cloud) ${state.app.slug}`
7077
break

src/test/cloud/ui/pickers.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ suite("cloud/ui/pickers", () => {
146146
})
147147

148148
sinon.stub(vscode.window, "showInputBox").resolves("my-app")
149-
const infoStub = sinon.stub(ui, "showInformationMessage")
150149

151150
const result = await createNewApp(api, team1, "default-name")
152151

153152
assert.deepStrictEqual(result, createdApp)
154-
assert.ok(infoStub.calledOnce)
155153
})
156154

157155
test("returns null when user cancels input", async () => {

0 commit comments

Comments
 (0)