mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	left_sidebar: Let current_section_id_for_stream return undefined.
Fixes this issue from Sentry: https://zulip.sentry.io/issues/6778533249/events/9e2a25e419bc4dc2b7a207c5a482f943/?project=4504556882821120
This commit is contained in:
		| @@ -696,7 +696,9 @@ export function refresh_pinned_or_unpinned_stream(sub: StreamSubscription): void | ||||
|     build_stream_sidebar_row(sub); | ||||
|     update_streams_sidebar(); | ||||
|     const section_id = stream_list_sort.current_section_id_for_stream(sub.stream_id); | ||||
|     maybe_hide_topic_bracket(section_id); | ||||
|     if (section_id !== undefined) { | ||||
|         maybe_hide_topic_bracket(section_id); | ||||
|     } | ||||
|  | ||||
|     // Only scroll pinned topics into view.  If we're unpinning | ||||
|     // a topic, we may be literally trying to get it out of | ||||
| @@ -967,7 +969,7 @@ function on_sidebar_channel_click( | ||||
|     } | ||||
|  | ||||
|     const section_for_stream = stream_list_sort.current_section_id_for_stream(stream_id); | ||||
|     if (collapsed_sections.has(section_for_stream)) { | ||||
|     if (section_for_stream !== undefined && collapsed_sections.has(section_for_stream)) { | ||||
|         // In the event that user clicks on the channel in the left | ||||
|         // sidebar when its folder is collapsed, which is only there | ||||
|         // to click on if the user was already viewing that channel, | ||||
|   | ||||
| @@ -49,11 +49,11 @@ function current_section_ids_for_streams(): Map<number, StreamListSection> { | ||||
|     return map; | ||||
| } | ||||
|  | ||||
| export function current_section_id_for_stream(stream_id: number): string { | ||||
| // Will return undefined if the given stream isn't in the user's stream | ||||
| // list (i.e. they're not subscribed to it). | ||||
| export function current_section_id_for_stream(stream_id: number): string | undefined { | ||||
|     // Warning: This function is O(n), so it should not be called in a loop. | ||||
|     const section = current_section_ids_for_streams().get(stream_id); | ||||
|     assert(section !== undefined); | ||||
|     return section.id; | ||||
|     return current_section_ids_for_streams().get(stream_id)?.id; | ||||
| } | ||||
|  | ||||
| function compare_function(a: number, b: number): number { | ||||
|   | ||||
| @@ -261,7 +261,9 @@ export function update_channel_folder(sub: StreamSubscription, folder_id: number | ||||
|     stream_ui_updates.update_channel_folder_dropdown(sub); | ||||
|     stream_list.build_stream_list(false); | ||||
|     const section_id = stream_list_sort.current_section_id_for_stream(sub.stream_id); | ||||
|     stream_list.maybe_hide_topic_bracket(section_id); | ||||
|     if (section_id !== undefined) { | ||||
|         stream_list.maybe_hide_topic_bracket(section_id); | ||||
|     } | ||||
| } | ||||
|  | ||||
| export function reset_dropdown_set_to_archived_folder(folder_id: number): void { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user