From 24d2b42849f7c0675cf5b122fdc0a067d8f6828c Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 23 Feb 2025 11:49:14 -0500 Subject: [PATCH] Fix unconnected source-removed signal --- src/notificationsMonitor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/notificationsMonitor.js b/src/notificationsMonitor.js index 35471e0..15312bc 100644 --- a/src/notificationsMonitor.js +++ b/src/notificationsMonitor.js @@ -148,8 +148,9 @@ export const NotificationsMonitor = class extends EventEmitter { } _checkNotifications() { + let getSourceId = (source) => source?._appId || source?.app?.id let addSource = (tray, source) => { - let appId = source?._appId || source?.app?.id + let appId = getSourceId(source) let updateTray = () => { this._updateState(appId, { trayCount: source.count, // always source.unseenCount might be less annoying @@ -176,8 +177,9 @@ export const NotificationsMonitor = class extends EventEmitter { Main.messageTray, 'source-removed', (tray, source) => { - if (source?._appId) - this._signalsHandler.removeWithLabel(source._appId) + let appId = getSourceId(source) + + if (appId) this._signalsHandler.removeWithLabel(appId) }, ], )