fix(electron): fix tab view blink issue on open new tab (#7748)

fix AF-1197
This commit is contained in:
pengx17
2024-08-06 15:57:40 +00:00
parent 744cc542de
commit c2cf331ff7
10 changed files with 105 additions and 84 deletions
+10 -8
View File
@@ -19,6 +19,7 @@ function getActiveWindows() {
}
export function registerEvents() {
const unsubs: (() => void)[] = [];
// register events
for (const [namespace, namespaceEvents] of Object.entries(allEvents)) {
for (const [key, eventRegister] of Object.entries(namespaceEvents)) {
@@ -52,14 +53,15 @@ export function registerEvents() {
});
});
});
app.on('before-quit', () => {
// subscription on quit sometimes crashes the app
try {
unsubscribe();
} catch (err) {
logger.error('unsubscribe error', err);
}
});
unsubs.push(unsubscribe);
}
}
app.on('before-quit', () => {
// subscription on quit sometimes crashes the app
try {
unsubs.forEach(unsub => unsub());
} catch (err) {
logger.error('unsubscribe error', err);
}
});
}