fix(chat): keep a preview on the row after a delete - #727
Merged
Conversation
Deleting the newest message left the conversation list blank until the chat was opened and closed again. Server metadata reports the newest message whatever its state, so the delete arrives as a tombstone `last_message`, and both seats for it — the feed load and a metadata refresh — wrote it to the row verbatim. Nothing draws for a tombstone, so the row went blank with an unread splat beside it. The store now refuses a tombstone as a preview. It keeps the visible message the row already carries, unless that is the message the tombstone replaces, and the feed load fills the gap from the newest visible message in the database — the path that already repaired the row on open, now run where the blank was seated. That is the fallback code-payments/code-android-app#1396 brought Android to; iOS only did it on the paths that already went through `refreshFeedPreview`. The two on-demand hydrates persist the server's copy rather than the store's, so the database still gets the tombstone row the repair reads to tell that the newest message was deleted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deleting the newest message left the conversation list blank until the chat was opened and closed again.
Server metadata reports the newest message whatever its state, so the delete arrives as a tombstone
last_message. Both seats for it wrote that to the feed row verbatim —setFeedon every feed load, andupserton a.metadataRefresh— and nothing draws for a tombstone, so the row went blank with an unread splat beside it.refreshFeedPreviewalready repaired the row from the database, but it ran on the transcript paths, which is why opening the chat and coming back fixed it.ConversationStorenow refuses a tombstone as a preview at both seats: it keeps the visible message the row already carries, unless that is the message the tombstone replaces, in which case the row clears rather than showing deleted content.loadFeed(type:)then runs the existing database repair for the conversations the server previewed with a tombstone, so the fallback lands where the blank was seated.markReadwas already correct — it takes the newest id from the database, tombstones included, so the read pointer does not park below a deleted message.This is the behaviour code-payments/code-android-app#1396 brought Android to: preview the newest message that still has content, and let the splat clear with it.
Also here: the two on-demand hydrates persist the server's
Conversationrather than the store's. The store no longer carries the tombstone, and the database needs that row for the repair to tell the newest message was deleted.