You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments