zulip-mobile
zulip-mobile copied to clipboard
MessageList: Avoid entirely replacing html body when possible.
Forking from https://github.com/zulip/zulip-mobile/issues/3026, which is otherwise mostly resolved.
Currently, the entire html body in the WebView is replaced on any change to the message list (a new message is received, a new emoji reaction is made, a message is edited, etc.). While the largest possible symptom of this, the fresh fetching of images every time this happens, has been remedied by WebView's added ability to cache (see more detail in #3026), it would certainly be nice not to have to do this. EDIT: And, in fact, this doesn't help for realms affected by https://github.com/zulip/zulip-mobile/issues/3853!
Incremental changes are possible; as @gnprice points out, we don't want to have to maintain diff-checking logic for all possible changes within a message. A good approach is probably to allow the entire replacement of a single message on any change to it. So if it's added, edited, reacted to, starred, etc., treat all these the same way -- just replace that message entirely.
EDIT: Especially with #4527 in mind, it'd be good to allow a message to update separately from its reactions—that issue won't be fixed unless we go further than the "good approach" in that last paragraph.
This functionality makes the mobile app really clunky to use. Any action results in a half second long delay as the DOM is re-rendered in its entirety, at least on my Pixel 6 Pro—especially since it keeps so many posts loaded on the page. After enough messages are sent the delay gets larger and larger as the posts stack up, and I assume this also takes up more memory. Images reloading constantly is also very painful, moreso when on a metered or slow connection.
I now know thankfully that the images reloading can be resolved by adjusting my proxy config to add caching headers, but it's still annoying that such a thing could happen in the first place.