The code below describes a UITableViewCell that shows the interlocutor’s name, their presence status, and allows opening a profile card by tapping a button. After a recent change, the behavior became unstable during fast scrolling and repeated cell reconfiguration.
ConversationRow passed in the last call to configure(row:presenceService:onProfileTap:)."—" must be shown.A.configure again for row B on the same cell.PresenceService requests to finish.Profile button after the reconfiguration.To reproduce, it is enough to use a deterministic mock that returns statuses with different delays, for example:
A -> "Online" after 200 ms
B -> "Away" after 10 ms
B should remain on screen.A must not overwrite the already displayed status for row B.Profile button must open the profile for row B if that is the one passed last.prepareForReuse(), the cell must not retain any action or asynchronous work from the previous configuration.Swift 6UITableViewCell is reused by the standard UITableView mechanism@MainActorTask and async/await are usedPresenceService mock, no networkUse line comments to explain the problem, its impact, the fix and how to test it.