Fix custom instances not showing up when typed into the instance
selector search field With Combine Cancellables are automatically cancelled on deinit, so the instance selector needs to hold on to a reference to pipeline cancellable for its lifetime, otherwise it's cancelled immediately after creation. Closes #59
This commit is contained in:
parent
18c3c3c434
commit
6ef643e374
|
@ -26,6 +26,7 @@ class InstanceSelectorTableViewController: UITableViewController {
|
||||||
var recommendedInstances: [InstanceSelector.Instance] = []
|
var recommendedInstances: [InstanceSelector.Instance] = []
|
||||||
|
|
||||||
let urlCheckerSubject = PassthroughSubject<String?, Never>()
|
let urlCheckerSubject = PassthroughSubject<String?, Never>()
|
||||||
|
var urlHandler: AnyCancellable?
|
||||||
var currentQuery: String?
|
var currentQuery: String?
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
@ -66,7 +67,7 @@ class InstanceSelectorTableViewController: UITableViewController {
|
||||||
navigationItem.searchController = searchController
|
navigationItem.searchController = searchController
|
||||||
definesPresentationContext = true
|
definesPresentationContext = true
|
||||||
|
|
||||||
_ = urlCheckerSubject
|
urlHandler = urlCheckerSubject
|
||||||
.debounce(for: .seconds(1), scheduler: RunLoop.main)
|
.debounce(for: .seconds(1), scheduler: RunLoop.main)
|
||||||
.compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
|
.compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
|
||||||
.sink(receiveValue: updateSpecificInstance)
|
.sink(receiveValue: updateSpecificInstance)
|
||||||
|
|
Loading…
Reference in New Issue