Reuse account nodes, which should fix at least one cause of the bug where sometimes the On My Mac group item collapses when it shouldn’t.

This commit is contained in:
Brent Simmons 2017-12-18 12:43:18 -08:00
parent c65757bab3
commit 7d68e3322c

View File

@ -107,7 +107,12 @@ private extension SidebarTreeControllerDelegate {
func sortedAccountNodes(_ parent: Node) -> [Node] {
let nodes = AccountManager.shared.accounts.map { createNode(account: $0, parent: parent) }
let nodes = AccountManager.shared.accounts.map { (account) -> Node in
let accountNode = parent.existingOrNewChildNode(with: account)
accountNode.canHaveChildNodes = true
accountNode.isGroupItem = true
return accountNode
}
return nodes.sortedAlphabetically()
}