Page MenuHomePhorge

Implement list diff for room timeline
Needs ReviewPublic

Authored by tusooa on Tue, Oct 6, 11:40 AM.

Details

Reviewers
None
Group Reviewers
O1: the Kazv Project
Summary

Originally we do not consider actual addition places for room timeline, and cheat by telling Qt everything is inserted at the latest end of the timeline. This causes problems for item-reuse in the list view, and scrolling to the early end of the timeline ("up") will sometimes cause items to jump. Now we implement a diff algorithm for the model. When the cursor is updated, the internal state will be updated according to Qt's expectations.

Our diff algorithm takes O(N) time, and the application of the diff takes effectively O(C logN) time, where N is the length of timeline and C is the number of changes. However, the time for Qt to update the model indices is O(CN). We cannot avoid this cost unless we implement our own list view. This is possible but we shall now postpone it for further work.

Type: add

Test Plan

Check timeline, including local echo, still works. Check that when scrolling up the timeline it is no longer jumpy even if more events are loaded from the db store or pagination API.

Diff Detail

Repository
rK kazv
Branch
tusooa/stacked
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 727
Build 1436: Invoke BuildbotBuildbot build #2745
Build 1435: arc lint + arc unit