     func searchMessages(withText text: String) {
         data.searchMessages(withText: text) {
             DispatchQueue.main.async {
+                if self.searchBar.text == nil || self.searchBar.text == "" {
+                    self.data.cellsPages = []
+                }
+
                 self.collectionView.reloadData()
                 self.updateIsEmptyMessage()
             }

    }

    @objc func close() {
        presentingViewController?.dismiss(animated: true, completion: nil)
    }
}


        guard let label = collectionView.backgroundView as? UILabel else { return }

        if data.cells.count == 0 {
            if data.isSearchingMessages && (searchBar.text == nil || searchBar.text == "")
                    || data.isLoadingSearchResults {
                label.text = ""
                return
            }

            label.text = localized("chat.messages.list.empty")
        } else {
            label.text = ""
