GeopJr / Tuba

[On break until 2024-07-15] Browse the Fediverse
https://tuba.geopjr.dev/
GNU General Public License v3.0
511 stars 55 forks source link

[Request]: Migrate timelines to ListView #179

Open bleakgrey opened 1 year ago

bleakgrey commented 1 year ago

Describe the request

This is going to be a long one.

As discussed previously, the status widget in its current state is causing us quite a bit of trouble. It's being pestered by 3 major issues:

Property binding issues There are some obscure errors caused by property binding lifecycle management, which renders some things broken (#103).

I believe this can be addressed by using Expressions introduced in GTK4. I'll quote the GTK team's post directly: GObject’s GBinding mechanism goes in the right direction, but is not flexible enough to handle situations where you may need to bind properties of sub-objects or widgets deep inside the hierarchy of your widget, and where the objects in questions may not even exist at the time you are setting up the binding.

I believe this is something we should try using instead.

View architecture Back when Tootle was a thing, I used .ui files to describe views. I found it a good way to separate layout from logic, and I still think we should stick to it. However, Tuba widened its scope quite a bit by adding support for new instance backends and instance features. I proposed a potential solution in #57 to accommodate these changes, but now I'm rather skeptical about my proposal as: a) the performance gains in #128 turned out to be rather negligent b) it seems to make the developer's quality of life worse by reverting back to defining views via code

Scalability Due to the fact that timelines use a ListBox (which constructs a widget for each status) and continuous scrolling, it may be a bottleneck for some low-end devices. Timelines can be modernized by porting them to use a ListView instead, which GTK devs recommend doing anyway: While it is not a problem for short lists to instantiate widgets for every item in the model, once lists grow to thousands or millions of elements, this gets less feasible. Because of this, the views only create a limited amount of listitems and recycle them by binding them to new items. In general, views try to keep listitems available only for the items that can actually be seen on screen.

All things considered, I think we've been optimizing the wrong thing. I've been searching for a way to reduce the complexity of the widget's hierarchy, when it makes much more sense to reduce the amount of the status widgets visible.

I propose doing the following:

All ideas are open for discussion, of course!

Implementation Details

GeopJr commented 1 year ago

Sounds good!

edit: points no longer apply

cyrneko commented 1 year ago

Really hope this can be implemented (if it - as proposed - helps with performance)

Loading posts in any way takes some time on my end, not because of the network but rather because it begins to lag whenever it loads new posts.