From ceb75323fefa788d0cb7032df3d4cf0aee258722 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Wed, 5 Feb 2020 13:58:18 +0300 Subject: [PATCH] restore tab colors during recovery (fixes #1713) --- terminus-core/src/services/tabRecovery.service.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/terminus-core/src/services/tabRecovery.service.ts b/terminus-core/src/services/tabRecovery.service.ts index 4a7b21c0..49be0a47 100644 --- a/terminus-core/src/services/tabRecovery.service.ts +++ b/terminus-core/src/services/tabRecovery.service.ts @@ -21,7 +21,16 @@ export class TabRecoveryService { window.localStorage.tabsRecovery = JSON.stringify( await Promise.all( tabs - .map(tab => tab.getRecoveryToken()) + .map(tab => { + let token = tab.getRecoveryToken() + if (token) { + token = token.then(r => { + r.tabColor = tab.color + return r + }) + } + return token + }) .filter(token => !!token) ) ) @@ -31,7 +40,9 @@ export class TabRecoveryService { for (const provider of this.config.enabledServices(this.tabRecoveryProviders)) { try { const tab = await provider.recover(token) - if (tab) { + if (tab !== null) { + tab.options = tab.options || {} + tab.options.color = token.tabColor || null return tab } } catch (error) {