Commit graph

620 commits

Author SHA1 Message Date
Travis Ralston
9e76a2cebf Handle off-cycle filtering updates in the new room list 2020-07-10 11:07:47 -06:00
Travis Ralston
477472c178 Merge branch 'develop' into travis/room-list/showmore2 2020-07-10 10:57:17 -06:00
Travis Ralston
26427817f2 Fix potential listener conflict with RVS
If the RVS ever emits something that contains `trigger: false`, we're pretty screwed, so avoid that.
2020-07-10 08:18:40 -06:00
Travis Ralston
a5ba0cad1f Rename to trigger and add docs 2020-07-10 08:13:23 -06:00
Travis Ralston
ef18cd5ca1 Merge branch 'develop' into travis/room-list/perf/dedupe-recalc 2020-07-10 07:18:12 -06:00
Travis Ralston
cf154ec9cf Add an option to disable room list logging, and improve logging
For https://github.com/vector-im/riot-web/issues/14035

**This option is not recommended as it completely obliterates all chances of being able to support someone with a broken room list. It is intended for specific testing scenarios only.**
2020-07-09 18:19:38 -06:00
Travis Ralston
8624e8beeb Break up the event loop tasks for the room list
The room list does a hefty amount of work, so instead of blocking the event loop with a `/sync` request and a bunch of room updates (as we can get multiple per sync) we can instead run it over several smaller tasks. The smaller tasks help the event loop do other things between our tasks, ensuring we don't inadvertently block the UI from rendering too slowly.

On my account and machine, this cuts the time to render in half (~30ms, down from ~60ms) .
2020-07-09 15:11:21 -06:00
Travis Ralston
1315f34662 Dedupe room list store updates by marking for updates
The core of this is in the MarkedExecution class, with the remainder of the commit ensuring that the right marks and triggers are in place to do the firing.

Because everything is async/await and run through the RoomListStore, we don't have to worry about self-fed updates in the algorithm classes. This also means we have to trigger pretty much all the time. 

Changes to tag ordering / list sorting get hit through two paths, so we mark before we do a bulk update and otherwise assume the call is coming in from outside.
2020-07-09 14:53:14 -06:00
Travis Ralston
859f65659c Attempt to support a hard cutoff with the show more button
Known issues:
* Causes scroll jumps when the button gets added to DOM
* Resize handle is invisible when there's a show more button

TODO:
* Clean up comments
* Clean up useless code (all the padding stuff isn't needed)
2020-07-09 13:07:13 -06:00
Bruno Windels
ce68314de9 Revert "Merge pull request #4932 from matrix-org/travis/room-list/invisible-show-more"
This reverts commit f58a0a7538.
2020-07-09 12:13:12 -06:00
Travis Ralston
f8e1996e2f Handle NewRoom and PossibleTagChange updates correctly
For new rooms, we need to append to our list of known rooms. For tag changes, we need to be sure to update our cache when the tag can reasonably be assumed to have changed.

Fixes https://github.com/vector-im/riot-web/issues/14389
2020-07-09 12:08:40 -06:00
Travis Ralston
00fc34924c Fix rooms disappearing that were created by the user
Fixes https://github.com/vector-im/riot-web/issues/14388

We were receiving a read receipt before a room object, leading to the algorithm to assume the room is archived (no membership), which was causing later index issues when the room tried to get moved from archived to untagged.

To prevent this, we just ignore nonsensical updates.
2020-07-09 11:39:40 -06:00
Travis Ralston
ae09bfb8fd Don't destroy room notification states when replacing them
The "should never happen" now happens a lot by design. We shouldn't destroy the state as it'll stop badge counts for everything.

Fixes https://github.com/vector-im/riot-web/issues/14391
2020-07-09 10:22:04 -06:00
Bruno Windels
f58a0a7538
Merge pull request #4932 from matrix-org/travis/room-list/invisible-show-more
Potential solution to supporting transparent 'show more' buttons
2020-07-09 14:43:20 +00:00
Travis Ralston
57b2ae9a0d Merge branch 'develop' into travis/room-list/perf/notifications 2020-07-09 07:46:01 -06:00
Travis Ralston
8aa2ed0c8b
Merge pull request #4934 from matrix-org/travis/room-list/perf/layout
Move list layout management to its own store
2020-07-09 07:44:44 -06:00
Jorik Schellekens
ecc109c45d
Merge pull request #4933 from matrix-org/joriks/room-list-noop-first-breadcrumb
Noop first breadcrumb
2020-07-09 13:47:38 +01:00
Travis Ralston
47380306c2 Move and improve notification state handling
Previously we were creating a notification state whenever we needed one, which was leading to hundreds of listeners even on a small account. To ease the burden, and reduce the load of having to wake so many listeners, we now record a single listener for each tag ID and room combination.

This commit also introduces a number of utilities to make future notification work a bit of an easier transition, such as the `isX` and `hasX` getters on the new NotificationState abstract class. Similarly, "snapshots" have been added to reduce code duplication between different kinds of states checking for updates.

The ListNotificationState is now heavily tied into the store which offers it to help reuse the cache of room notification states. 

Fixes https://github.com/vector-im/riot-web/issues/14370
2020-07-08 19:26:25 -06:00
Travis Ralston
62b4596c04 Be consistent with other stores 2020-07-08 18:36:56 -06:00
Travis Ralston
c8f90be81d Ensure the map gets cleared upon logout 2020-07-08 18:32:12 -06:00
Jorik Schellekens
2baa78d26b Move no-op to breadcrumb store 2020-07-09 01:31:44 +01:00
Travis Ralston
c5812d6c27 Move list layout management to its own store
This is more general maintenance than performance as the RoomList doesn't need to be generating layouts for the sublists, and it certainly doesn't need to be creating a bunch of extra ones. 

The sublists are perfectly capable of getting their own layout instance and using it, and we are perfectly able to limit the number of these things we create through the session's lifespan.
2020-07-08 18:28:21 -06:00
Travis Ralston
8972cf9378 Potential solution to supporting transparent 'show more' buttons
In this demonstration, we remove the cutting line (as it collides with the tile in a weird spot) and instead replace the tile with a placeholder when the text is about to collide with the avatar in the tile. We use a `round()` for this because through some amazing coincidence the collision happens at 0.47, which is close enough to 0.5 for people not to notice.
2020-07-08 16:09:45 -06:00
Travis Ralston
9b48130f4f Protect rooms from getting lost due to complex transitions
Fixes https://github.com/vector-im/riot-web/issues/14378

Rooms transitioning between multiple states are often at risk of going missing due to the sticky room handling. We now protect that transition by bluntly ensuring the room can't go missing, and by always ensuring we have an updated reference to the room.
2020-07-08 11:48:34 -06:00
Travis Ralston
3912f2d21c Merge remote-tracking branch 'origin/develop' into travis/room-list/resizable 2020-07-08 07:55:10 -06:00
Travis Ralston
b4f3b8ab11 Use the right variables when detecting max height 2020-07-08 07:53:55 -06:00
Michael Telatynski
5ef93686d9
Merge pull request #4925 from matrix-org/t3chguy/room-list/14352
Use html innerText for org.matrix.custom.html m.room.message room list previews
2020-07-08 13:23:58 +01:00
Michael Telatynski
8d5d3b1c92 Use html innerText for org.matrix.custom.html m.room.message room list previews
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-07-08 08:50:25 +01:00
Travis Ralston
15b6a273c9 Swap out the resizer lib for something more stable
react-resizer appears to be okay at tracking state, but it often desyncs from reality. re-resizer is more maintained and more broadly used (160k downloads vs 110k), and appears to generally do a better job of tracking the cursor.

The new library has some oddities though, such as deltas, touch support (hence the polyfill), and calling handles "Enable".

For https://github.com/vector-im/riot-web/issues/14022
2020-07-07 22:21:00 -06:00
Travis Ralston
774e32ecf0 Fix DM handling in new room list 2020-07-07 16:16:46 -06:00
Travis Ralston
85e018111b
Merge pull request #4918 from matrix-org/travis/room-list/respect-old-settings
Respect and fix understanding of legacy options in new room list
2020-07-07 15:19:56 -06:00
Travis Ralston
3dfb9711ed
Merge pull request #4916 from matrix-org/travis/room-list/dm-handle
Ensure DMs are not lost in the new room list, and clean up tag logging
2020-07-07 15:14:27 -06:00
Travis Ralston
a4ef5909f9 Respect and fix understanding of legacy options
Fixes https://github.com/vector-im/riot-web/issues/14372

We read/use the options in multiple places, and those places were not in sync. Now when algorithms change and on initial load, both will come to the same conclusions about how to order & sort the rooms.
2020-07-07 14:45:08 -06:00
Travis Ralston
34ea8342fb Remove comment claiming encrypted rooms are handled incorrectly
Fixes https://github.com/vector-im/riot-web/issues/14238

The encrypted rooms are loaded on startup (eventually), so we don't need to worry about the problem described.
2020-07-07 13:49:36 -06:00
Travis Ralston
2488520263 Clean up tag logging in setKnownRooms
We don't need this anymore
2020-07-07 13:46:29 -06:00
Travis Ralston
be1b2fddaf Ensure DMs are not lost in the new room list
Fixes https://github.com/vector-im/riot-web/issues/14236
2020-07-07 13:46:10 -06:00
Michael Telatynski
8ba2be0be5
Merge pull request #4900 from matrix-org/t3chguy/room-list/1234
New Room List implement view_room_delta for keyboard shortcuts
2020-07-07 15:36:30 +01:00
Travis Ralston
7173ea71a5
Merge pull request #4905 from matrix-org/travis/room-list/room-safety
Improve room safety in the new room list
2020-07-07 06:59:59 -06:00
Travis Ralston
b3b404f121
Merge pull request #4906 from matrix-org/travis/room-list/invites-list
Fix a number of issues with the new room list's invites
2020-07-07 06:55:30 -06:00
Travis Ralston
2c502ed2fe Decrease default visible rooms down to 5 2020-07-06 20:48:49 -06:00
Travis Ralston
56333ae017 Ensure the recents algorithm is aware of invites 2020-07-06 20:42:43 -06:00
Travis Ralston
8739e2f781 Fix room duplication when the sticky room reference changes 2020-07-06 20:12:25 -06:00
Travis Ralston
34bd59c151 Remove the lock around the algorithm
This isn't needed
2020-07-06 19:38:13 -06:00
Travis Ralston
70e5da677b Clean up debug logging 2020-07-06 19:38:13 -06:00
Travis Ralston
dd833f4f2f Ensure the sticky room changes if the tag changes
This fixes a case where a user accepts an invite, which causes a tag change, but the room stays stuck in the invites list. The tag change additionally gets swallowed when the user moves away, causing the room to get lost. 

By moving it when we see it, potentially during a sticky room change itself (though extremely rare), we avoid having the room get lost in the wrong lists. A side effect of this is that accepting an invite puts it at the top of the tag it's going to (usually untagged), however this feels like the best option for the user.

A rare case of a tag change happening during a sticky room change is when a leave event comes in for the sticky room, but because it's come through as a tag change it can get swallowed. If it does get swallowed and the user clicks away, the tag change will happen when the room is re-introduced to the list (fake NewRoom event).
2020-07-06 19:38:13 -06:00
Travis Ralston
4345f972e0 Handle sticky room to avoid accidental removal
Plus a bunch of logging.

This fixes a case where switching rooms would cause the last room you were on to disappear due to an optimization where known NewRoom fires would be translated to tag change fires, which wouldn't re-add the room to the underlying tag algorithm.

By tracking the last sticky room, we can identify when we're about to do this and avoid it. 

This commit also adds a check to ensure that we have the latest reference of a room stored as rooms changing from invite -> join change references.

This commit additionally updates the PossibleTagChange handling to be faster and smarter, leading to a more stable generation of the room list. We convert the update cause to a Timeline update in order to indicate it is a change within the same tag rather than having to jump tags. This also means that PossibleTagChange should no longer make it as far as the underlying algorithm.

New logging has also been added to aid debugging.
2020-07-06 19:38:13 -06:00
Travis Ralston
18df29b627 Flag & add some debugging 2020-07-06 19:38:13 -06:00
Travis Ralston
0b6f744a58 Wrap handleRoomUpdate in a lock
Dev note: this is removed in a later commit
2020-07-06 19:38:13 -06:00
Michael Telatynski
1849ed90d2 Implement ViewRoomDelta for the new Room List
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2020-07-06 17:58:29 +01:00
Travis Ralston
9c1efe728c
Revert "Remove a bunch of noisy logging from the room list" 2020-07-03 08:54:54 -06:00