Long freeze when first messages load #10
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: badrihippo/convo#10
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When the first messages load, the app "freezes" for a long time. This is probably because it's set to update the messages array every time an event comes in, which, the first time you log in, would mean a lot of events!
A solution would be to space out this "every message" reaction in the first minute or so: instead of "every message", it should set a clock or something that refreshes every, say, 5 seconds, and then switch to one second. That way, people can start scrolling without having to wait for all the messages to come in.
(The main problem here is that Svelte requires an
=
assignment to start working. But actually, that might not be a bad thing because if it automatically updated the display everytime any small thing got changed it would still/ result in a lot of overhead!)A stopgap measure has been implemented for this in
8d1ca787fa
. Basically, we don't auto-join groupchats at all, because the large number of incoming messages from there was causing the app to freeze regardless of the auto-rendering.Another optimisation, added in
15bfc1599b
, replaces the rendering function with a lighter version that only includes the required data instead of the whole shebang. This will make the function more efficient, although it still doesn't address the fact that it may be called too many times.But we should still implement the original proposal at some point, because the issue will remain when a user receives many private messages at once, or when the messages start coming in after they've manually joined a groupchat.