Skip to content

Commit

Permalink
fix(sheets): Always change sheet when changing perspective (#2094)
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed May 3, 2016
1 parent 7024dad commit 5f166cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 0 additions & 4 deletions internal_packages/account-sidebar/lib/sidebar-item.coffee
Expand Up @@ -93,7 +93,6 @@ class SidebarItem
return item.dataTransferType in event.dataTransfer.types

onSelect: (item) ->
Actions.selectRootSheet(WorkspaceStore.Sheet.Threads)
Actions.focusMailboxPerspective(item.perspective)
}, opts)

Expand Down Expand Up @@ -141,9 +140,6 @@ class SidebarItem
@forDrafts: (accountIds, opts = {}) ->
perspective = MailboxPerspective.forDrafts(accountIds)
id = "Drafts-#{opts.name}"
opts.onSelect = ->
Actions.focusMailboxPerspective(perspective)
Actions.selectRootSheet(WorkspaceStore.Sheet.Drafts)
@forPerspective(id, perspective, opts)

module.exports = SidebarItem
9 changes: 9 additions & 0 deletions src/flux/stores/focused-perspective-store.coffee
@@ -1,6 +1,7 @@
_ = require 'underscore'
NylasStore = require 'nylas-store'
AccountStore = require './account-store'
WorkspaceStore = require './workspace-store'
MailboxPerspective = require '../../mailbox-perspective'
CategoryStore = require './category-store'
Actions = require '../actions'
Expand Down Expand Up @@ -76,6 +77,14 @@ class FocusedPerspectiveStore extends NylasStore
@_current = perspective
@trigger()

if perspective.drafts
desired = WorkspaceStore.Sheet.Drafts
else
desired = WorkspaceStore.Sheet.Threads

if desired and WorkspaceStore.rootSheet() isnt desired
Actions.selectRootSheet(desired)

_setPerspectiveByName: (categoryName) ->
categories = @_current.accountIds.map (aid) ->
CategoryStore.getStandardCategory(aid, categoryName)
Expand Down
1 change: 0 additions & 1 deletion src/flux/stores/workspace-store.coffee
@@ -1,7 +1,6 @@
_ = require 'underscore'
Actions = require '../actions'
AccountStore = require './account-store'
FocusedPerspectiveStore = require './focused-perspective-store'
CategoryStore = require './category-store'
MailboxPerspective = require '../../mailbox-perspective'
NylasStore = require 'nylas-store'
Expand Down

0 comments on commit 5f166cc

Please sign in to comment.