Skip to content

Commit 5f90394

Browse files
committed
fix: a floating promise remains when showing notification
1 parent d9e50d2 commit 5f90394

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎src/ghosttext-adaptor/email_editor.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ export class EmailEditor implements IClientEditor, IStatusIndicator {
2020
private readonly options: ClientOptions,
2121
) {}
2222

23-
update(status: ClientStatus): Promise<void> {
23+
async update(status: ClientStatus): Promise<void> {
2424
const icon = imageForStatus(status)
25+
const isNewStatus = status !== (this.lastStatus ?? "inactive")
2526

26-
if (status !== (this.lastStatus ?? "inactive")) {
27-
this.notificationTray.showNotification(icon, messageForStatus(status))
28-
}
2927
this.lastStatus = status
3028

31-
return this.composeWindow.setIcon(icon)
29+
await Promise.all([
30+
isNewStatus && this.notificationTray.showNotification(icon, messageForStatus(status)),
31+
this.composeWindow.setIcon(icon),
32+
])
3233
}
3334

3435
async getState(): Promise<EmailState> {

0 commit comments

Comments
 (0)