Skip to content

Commit

Permalink
Avoid the default empty state appearing at unexpected times.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed Feb 21, 2022
1 parent 610583e commit ecd6d68
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions DuckDuckGo/SecureVault/Model/PasswordManagementItemListModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ final class PasswordManagementItemListModel: ObservableObject {
selected(item: nil)
}
}

func clear() {
update(items: [])
filter = ""
clearSelection()

// Setting items to an empty array will typically show the No Data empty state, but this call is used when
// the popover is closed so instead there should be no empty state.
emptyState = .none
}

func clearSelection() {
selected = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ final class PasswordManagementViewController: NSViewController {
}

func clear() {
self.listModel?.update(items: [])
self.listModel?.filter = ""
self.listModel?.clearSelection()
self.listModel?.clear()
self.itemModel?.clearSecureVaultModel()
}

Expand Down

0 comments on commit ecd6d68

Please sign in to comment.