prose-im/prose-core-client

Merge older fastenings from the cache when paging through a conversation

Closed this issue · 0 comments

When the user scrolls through a conversation we're loading every message from MAM up to the requested point.

The order is always from newest to oldest. Each loaded page of messages is then saved to the cache. Due to the nature of XMPP all messages are loaded in a stream where newer messages can reference older messages, e.g. a reaction to an older message results in a new message carrying the reaction.

When scrolling further up to see older messages the core lib should fetch the newer - already loaded - messages from the cache that reference the loaded older messages to reduce them into their final state: A single message object that contains all read markers, reactions and so on.

This approach works perfectly fine for this use case but would not work for displaying an older message when the newer messages have not been loaded before. To handle this second case efficiently we'd need server support as mentioned in prose-im/prose-pod-system#10, but that is out of scope for this issue.

Also refs prose-im/prose-app-web#56