-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): Add the none
filter
#2594
feat(ui): Add the none
filter
#2594
Conversation
It's the opposite of the `all` filter. This one rejects all entries.
95ea5e9
to
ce2bac6
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2594 +/- ##
==========================================
- Coverage 77.84% 77.81% -0.03%
==========================================
Files 183 184 +1
Lines 19608 19610 +2
==========================================
- Hits 15263 15260 -3
- Misses 4345 4350 +5
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all well, but I'm not sure I like that we have that many filters.
It sounds like it should be a configuration on the fuzzy matcher filters, i.e. have a setting for them:
- Filter mode, starts with a full room list and removes entries that don't match the pattern.
- Search mode, starts with an empty room list and adds entries that match the pattern.
If the matching is normalized or not sounds also like it should have been a configuration option. Otherwise we risk the continued proliferation of filters that do almost the same thing.
I think having this as configuration options for a single filter would also make the documentation of this feature easier to follow.
That being said, in case this is immediately needed by EX, perhaps we should just open an issue and refactor and rework the API here later on.
I would agree if we would have more filters. I don't believe we would need more filters now, except maybe to filter by DM or by notifications, stuff like that, in a mid-term future. That's not what I consider a lot of filters though (personal opinion). Adding a Search mode as you suggest is likely to make the code more complex. Right now, the filter is filtering a matrix-rust-sdk/crates/matrix-sdk-ui/src/room_list_service/room_list.rs Lines 123 to 158 in 424135b
It's already a switched stream over a filtered + limited stream. Hopefully everything is well-tested, and I trust there is no bug in this code, but if we add a search mode, it makes the whole things more complex, while the solution is a simple Alternatively, we can ensure that an empty pattern on |
I'm going to merge this PR since it's required as a hotfix for iOS. But happy to discuss about it! |
A room list can be filtered by using filters. So far, we have:
all
that acceptsFilled
andInvalidated
room list entries, and rejectsEmpty
entries,fuzzy_match_room_name
that runs a fuzzy matcher on the room name,normalized_match_room_name
that runs a normalized matcher on the room name.When the pattern is empty, both the last filters accept the room list entry. That's a long-term well-known philosophical debate. I'm glad that the behavior is the same for both of the filters.
But that's a technical problem for us. There is no way to empty the room list based on a filter. It becomes a technical challenge for the client app implementors:
VectorDiff::Reset { values: [] }
, but it might takes time for the app UI to remove all items from the room list, thus resulting a UI blinking glitch between the time the room list is shown, and the time the room list is actually emptied.The solution is simple though. This patch introduces a new
none
filter. It rejects all room list entries, thus effectively emptying the room list. The client app won't hide and show the room list again, this logic is no longer necessary. Instead, the new logic is the following:all
filter for the “classic view”,none
filter,normalized_match_room_name
filter for example,none
filter,all
filter.It's a matter of switching the filter, which is more robust and deterministic than hiding or showing the room list based on some events etc.