-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure events get loaded if the timeline is empty
After fixing the race in the room switching procedure (see 4ce59f7) another race showed up, this time between the model reset and updating root.room property in QML. Because this property is distinct from messageModel.room, it gets updated later, specifically after onModelReset() is called. onModelReset() itself already uses messageModel.room instead of root.room exactly for that reason but ensurePreviousContent() called from there still operates on root.room. That alone wouldn't be much of a hurdle (ensurePreviousContent() could be rewired to messageModel.room just as well) but at the moment onModelReset() is called chatView has not created any delegates for the model yet - meaning that contentY and originY used in ensurePreviousContent() are 0 even when the model has plenty of events loaded, leading to a false-positive condition and an unneeded request to the homeserver for more messages. This commit moves requesting the initial batch of historical events to the model. It does not request a lot, therefore the turnaround is short; and that solves the timeline bootstrapping after a room switch. Eventually this might even move to libQuotient, because events have to be loaded to the room when it is displayed, regardless of the client - but that's something to ponder separately. And while we're at it, the property tracking the number of requested historical events has been moved to QuaternionRoom, anticipating its further move to libQuotient.
- Loading branch information
Kitsune Ral
committed
Jan 12, 2024
1 parent
25ce1c6
commit aef84cf
Showing
4 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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