Infinite loop after reset all facet filters - iOS

Hi, I run into some strange problem when removing all filters. I got custom table view that works fine with InstantSearch. Everything works fine but in one case InstantSearch runs into infinite loop. I have to add “pull down to refresh” table view and reset all selected filters.
When I selected filter, for ex. category, InstantSearch displays every item matching to the category and it is greate. Problem appears when I pull down the table view. FilterClearController did clear the filters but doesn’t return all items but only the same amount what was previous found (so if category:adveture contains 5 elements, after pull down I get only 5 different elements) and also it runs into infinite loop and after couple days of testing I got almost 10k search requests…
The strange thing is that when I run application using Algolia test credentials AppID: “latency” everything works fine.
This code is an example.

    self.textFieldController = TextFieldController(searchBar: searchBar)
    // Component that manages and displays a list of search results
    hitsInteractor.connectSearcher(searcher)
    hitsInteractor.connectController(hitsTableViewController)
    
    queryInputInteractor.connectSearcher(searcher)
    queryInputInteractor.connectController(self.textFieldController)
    
    searcher.connectFilterState(filterState)
    searcher.isDisjunctiveFacetingEnabled = false
    searcher.indexQueryState.query.hitsPerPage = 20
    // Select category
    filterState[and: "category"].add(Filter.Facet(attribute: "document.category", stringValue: "adventure"))
    searcher.indexQueryState.query.filters = filterState.description
    filterClearInteractor.connectFilterState(filterState,
                                             filterGroupIDs: nil,
                                             clearMode: .specified)
    filterClearInteractor.connectController(clearFiltersController)
    searcher.search()
    setupUI()

This is my initialize code. It returns me only the items that matches category. Inside setupUI I’m assigning to tableView.refreshControl = clearFiltersController.refreshController.
Bellow is my “custom” FilterClearController:

public class PullDownToRefreshController: FilterClearController {

  public let refreshController: UIRefreshControl

  public var onClick: (() -> Void)?

  public init(refreshController: UIRefreshControl) {
self.refreshController = refreshController
refreshController.addTarget(self, action: #selector(didPullDown), for: .valueChanged)
  }

  @objc private func didPullDown() {
onClick?()
refreshController.endRefreshing()
  }

}

Thanks for any kind of help!
Matt

Hi @matt11 ,

Your implementation looks correct, I don’t see any reason why infinite loop could happen.

Could you debug this by adding a breakpoint to the search() method in the SingleIndexSearcher or AbstractSearcher (depending on the version of InstantSearch you use) to figure out what triggers a search repetitively?