user_profile: Sort the stream list on update.

This commit fixes the issue of reordering the stream list when the
user unsubscribes from a stream. The issue was caused because, on
rendering, we sorted the list by name but did not sort it while
updating the stream list on any update.
This commit is contained in:
Palash Baderia 2022-10-11 17:50:27 +05:30 committed by Tim Abbott
parent 59cf305053
commit 1e85683570

View File

@ -46,6 +46,7 @@ export function update_user_profile_streams_list_for_users(user_ids) {
const user_id = get_user_id_if_user_profile_modal_open();
if (user_id && user_ids.includes(user_id) && user_streams_list_widget !== undefined) {
const user_streams = stream_data.get_streams_for_user(user_id).subscribed;
user_streams.sort(compare_by_name);
user_streams_list_widget.replace_list_data(user_streams);
}
}