mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-04 07:10:06 +08:00
fix(sidebar): Make sure saved sidebar accts are correct
- Sidebar accounts may become invalid when switching from staging to prod
This commit is contained in:
parent
e87096d7a3
commit
54a74e317d
2 changed files with 7 additions and 1 deletions
|
@ -218,6 +218,9 @@ class AccountStore extends NylasStore
|
|||
accounts: =>
|
||||
@_accounts
|
||||
|
||||
accountIds: =>
|
||||
_.pluck(@_accounts, 'id')
|
||||
|
||||
accountsForItems: (items) =>
|
||||
accounts = {}
|
||||
items.forEach ({accountId}) =>
|
||||
|
|
|
@ -116,7 +116,10 @@ class FocusedPerspectiveStore extends NylasStore
|
|||
@_current
|
||||
|
||||
sidebarAccountIds: =>
|
||||
NylasEnv.savedState.sidebarAccountIds ?= AccountStore.accounts().map((acc) => acc.id)
|
||||
NylasEnv.savedState.sidebarAccountIds ?= AccountStore.accountIds()
|
||||
accIdsAreInvalid = not NylasEnv.savedState.sidebarAccountIds.every((accId) => AccountStore.accountForId(accId)?)
|
||||
if accIdsAreInvalid
|
||||
NylasEnv.savedState.sidebarAccountIds = AccountStore.accountIds()
|
||||
return NylasEnv.savedState.sidebarAccountIds
|
||||
|
||||
module.exports = new FocusedPerspectiveStore()
|
||||
|
|
Loading…
Reference in a new issue