spreed icon indicating copy to clipboard operation
spreed copied to clipboard

Cache conversations to speed up conversation display

Open vagner-dias opened this issue 1 year ago • 4 comments

Presently, the current version of the Nextcloud desktop client lacks conversation caching, resulting in a delay when users click on a conversation.

Enhancing the user experience would involve enabling users to click on a conversation without having to wait for it to load. Instead, the conversation should be promptly displayed upon the user's click.

vagner-dias avatar Feb 07 '24 16:02 vagner-dias

A possible solution could be to cache conversations in IndexedDB and broadcast updates to other tabs, similar to the conversation list.

The complex part here would be as usual — cache invalidation:

  • Deleting messages
  • New feature — editing messages

When the client is loaded, it should somehow get updates about the messages from the cache that are to be updated or deleted. For example, always fetch conversation messages on open as currently, using cache only to optimize initial rendering and multi-tabs.

ShGKme avatar Feb 19 '24 14:02 ShGKme

When the client is loaded, it should somehow get updates about the messages from the cache that are to be updated or deleted.

There are hidden system messages being sent having the modified/deleted message as parent, because that is how the iOS app handles it.

nickvergessen avatar Feb 19 '24 16:02 nickvergessen

There are hidden system messages being sent having the modified/deleted message as parent, because that is how the iOS app handles it.

So, fetching new messages will inform about deleting/modifying old messages, poll changes (and reactions?). Then there is not this complex part, doable.

ShGKme avatar Feb 19 '24 17:02 ShGKme

[...] (and reactions?).

Yep. These are the messages we currently consider an "update message": https://github.com/nextcloud/talk-ios/blob/c53dd7b6cb05d793a542d2ca3ed69c5ac98e2933/NextcloudTalk/NCChatMessage.m#L254-L262

When we receive such a message, we update the corresponding message and the quotes of that message, see https://github.com/nextcloud/talk-ios/blob/c53dd7b6cb05d793a542d2ca3ed69c5ac98e2933/NextcloudTalk/BaseChatViewController.swift#L579-L614

SystemKeeper avatar Feb 22 '24 20:02 SystemKeeper