     }
     
     func reloadData() {
-        guard let tableView = tableView else { return }
-        tableView.reloadData()
+        guard let _ = tableView else { return }
+        // to update filteredSiteRecords before reloading the tableView
+        filterContentForSearchText(currentSearchText)
     }
     
     func numberOfSections(in tableView: UITableView) -> Int {

    private var tableView: UITableView!

    private var filteredSiteRecords = [WKWebsiteDataRecord]()
    
    init(viewModel: WebsiteDataManagementViewModel) {
        self.viewModel = viewModel


extension WebsiteDataSearchResultsViewController: UISearchResultsUpdating {
    func updateSearchResults(for searchController: UISearchController) {
        currentSearchText = searchController.searchBar.text ?? ""
        filterContentForSearchText(currentSearchText)
    }
}

