mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +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: =>
|
||||||
@_accounts
|
@_accounts
|
||||||
|
|
||||||
|
accountIds: =>
|
||||||
|
_.pluck(@_accounts, 'id')
|
||||||
|
|
||||||
accountsForItems: (items) =>
|
accountsForItems: (items) =>
|
||||||
accounts = {}
|
accounts = {}
|
||||||
items.forEach ({accountId}) =>
|
items.forEach ({accountId}) =>
|
||||||
|
|
|
@ -116,7 +116,10 @@ class FocusedPerspectiveStore extends NylasStore
|
||||||
@_current
|
@_current
|
||||||
|
|
||||||
sidebarAccountIds: =>
|
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
|
return NylasEnv.savedState.sidebarAccountIds
|
||||||
|
|
||||||
module.exports = new FocusedPerspectiveStore()
|
module.exports = new FocusedPerspectiveStore()
|
||||||
|
|
Loading…
Reference in a new issue