project-robius / robrix

Robrix: a multi-platform Matrix chat client written in Rust using the Makepad UI toolkit and the Robius app dev framework
MIT License
107 stars 18 forks source link

Move `ReplyPreviewClicked` action handling logic off of the main UI thread #257

Closed kevinaboos closed 1 day ago

kevinaboos commented 4 days ago

Now that #254 has landed, all of the MessageAction::ReplyPreviewClicked action handling logic should be moved to a background thread. Similarly, we should limit the number of items that we do a backwards search through on the main UI thread to no more than 25-50 items. Just like the known problem with PortalList::smooth_scroll_to(), we need to avoid iterating over potentially thousands of items on the main UI thread.

The main idea is that we would re-use the same BackwardsPaginateUntilEventRequest, and that the first operation that the timeline_subscriber_handler would take upon receiving that request is to search the existing known vector of timeline items for the target event before kicking off a backwards pagination request.

Originally posted by @kevinaboos in https://github.com/project-robius/robrix/issues/254#issuecomment-2484515497