fix(sidebar): Update sidebar correctly when an account added or removed

This commit is contained in:
Juan Tejada 2016-01-29 10:21:16 -08:00
parent 87a1fc6d29
commit 223f7fdde4

View file

@ -39,8 +39,8 @@ class SidebarStore extends NylasStore
_registerListeners: ->
@listenTo SidebarActions.focusAccounts, @_onAccountsFocused
@listenTo AccountStore, @_onAccountsChanged
@listenTo FocusedPerspectiveStore, @_updateSections
@listenTo AccountStore, @_updateSections
@listenTo WorkspaceStore, @_updateSections
@listenTo ThreadCountsStore, @_updateSections
@listenTo CategoryStore, @_updateSections
@ -60,6 +60,10 @@ class SidebarStore extends NylasStore
@_focusedAccounts = accounts
@_updateSections()
_onAccountsChanged: =>
@_focusedAccounts = AccountStore.accounts()
@_updateSections()
_updateSections: =>
accounts = @_focusedAccounts
multiAccount = accounts.length > 1