Skip to content

FUIFirestoreTableViewDataSource populateCell not called when document update causes cells to be reordered #676

@artmatsak

Description

@artmatsak

Step 2: Describe your environment

  • Objective C or Swift: Swift
  • iOS version: 12.2
  • Firebase SDK version: 5.20.2
  • FirebaseUI version: 6.2.1
  • CocoaPods Version: 1.6.1

Step 3: Describe the problem:

I'm binding a Firestore query to my UITableView as follows:

let query = userChannelsReference.order(by: "field1", descending: true)
dataSource = tableView.bind(toFirestoreQuery: query) { tableView, indexPath, snapshot in
    let cell = tableView.dequeueReusableCell(withIdentifier: "ChannelCell", for: indexPath)
    cell.textLabel?.text = snapshot.get("field2") as? String
    return cell
}
  • When I update just field2 in a document, populateCell is called and the corresponding cell's text is appropriately updated.
  • When I update both field1 and field2 in a document so that the field1 update doesn't change the order of cells, populateCell is called and the corresponding cell's text is appropriately updated.
  • When I update both field1 and field2 in a document so that the field1 update changes the order of cells, the cells get reordered but populateCell is not called. The cell's text gets stuck displaying the old field2 value.

Steps to reproduce:

  1. Bind UITableView to an ordered Firebase query like shown above.
  2. Run an update on a document that changes both field1 and field2 and that causes the cells to be reordered.

Observed Results:

  • The UITableView cells get reordered but populateCell does not get called.

Expected Results:

  • The UITableView cells get reordered and populateCell does get called.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions