You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a fix that either @sampritipanda or I should do in the short term (as it's closely related to #9999) or, if we get diverted, by somebody with a pretty strong understanding of stream_data.js and basic performance issues with filtering and sorting.
The first thing wrong with stream_data.get_streams_for_settings_page() is that the name is a bit misleading. We use it for other stuff, like copy-from-stream and compose typeahead. So it's really more generic than the current name indicates--it gets streams in our canonical sorting order. But the problems are a bit deeper.
First of all, it doesn't implement the best possible sort. In subs.filter_table we do a locale-aware sort that's probably what we want for all three features. So we'd want to extract out the sort from that function, which unfortunately has some other stuff going on, so it's not a totally trivial extraction.
Then the next thing to be aware of is that we generally want to do filtering before sorting, and two of the three features support filtering. Our stream_data API should ideally be something more like this:
stream_data.get_ids_matching_filter (for compose typeahead and stream settings left-panel)
stream_data.sort_ids_by_locale_and_subscribed (for all three features)
stream_data.ids_to_subs
stream_data.get_sorted_subs (only to be used by copy-from-stream, although it should really have a filter)
I'm not 100% sure what the exact API should be, but it should allow the following:
all features share the same sorting algorithm
features have control on being able to pre-filter ids before sorting
The text was updated successfully, but these errors were encountered:
Hello @zulip/server-refactoring, @zulip/server-streams members, this issue was labeled with the "area: refactoring", "area: stream settings" labels, so you may want to check it out!
This is a fix that either @sampritipanda or I should do in the short term (as it's closely related to #9999) or, if we get diverted, by somebody with a pretty strong understanding of
stream_data.js
and basic performance issues with filtering and sorting.The first thing wrong with
stream_data.get_streams_for_settings_page()
is that the name is a bit misleading. We use it for other stuff, like copy-from-stream and compose typeahead. So it's really more generic than the current name indicates--it gets streams in our canonical sorting order. But the problems are a bit deeper.First of all, it doesn't implement the best possible sort. In
subs.filter_table
we do a locale-aware sort that's probably what we want for all three features. So we'd want to extract out the sort from that function, which unfortunately has some other stuff going on, so it's not a totally trivial extraction.Then the next thing to be aware of is that we generally want to do filtering before sorting, and two of the three features support filtering. Our stream_data API should ideally be something more like this:
stream_data.get_ids_matching_filter
(for compose typeahead and stream settings left-panel)stream_data.sort_ids_by_locale_and_subscribed
(for all three features)stream_data.ids_to_subs
stream_data.get_sorted_subs
(only to be used by copy-from-stream, although it should really have a filter)I'm not 100% sure what the exact API should be, but it should allow the following:
The text was updated successfully, but these errors were encountered: