diff --git a/Persephone/Components/Window/WindowController.swift b/Persephone/Components/Window/WindowController.swift index 1d6f050..f77e094 100644 --- a/Persephone/Components/Window/WindowController.swift +++ b/Persephone/Components/Window/WindowController.swift @@ -163,8 +163,7 @@ class WindowController: NSWindowController { } @IBAction func handleSearchQuery(_ sender: NSSearchField) { - //App.store.dispatch(SetSearchQuery(searchQuery: sender.stringValue)) - App.mpdClient.fetchAlbums(filter: sender.stringValue) + App.store.dispatch(SetSearchQuery(searchQuery: sender.stringValue)) } } diff --git a/Persephone/State/Reducers/UIReducer.swift b/Persephone/State/Reducers/UIReducer.swift index 1ce0e33..b788e14 100644 --- a/Persephone/State/Reducers/UIReducer.swift +++ b/Persephone/State/Reducers/UIReducer.swift @@ -6,6 +6,7 @@ // Copyright © 2019 Dan Barber. All rights reserved. // +import AppKit import ReSwift func uiReducer(action: Action, state: UIState?) -> UIState { @@ -35,6 +36,9 @@ func uiReducer(action: Action, state: UIState?) -> UIState { case let action as SetSearchQuery: state.searchQuery = action.searchQuery + DispatchQueue.main.async { + App.mpdClient.fetchAlbums(filter: state.searchQuery) + } default: break