narrow_history: Remove invalid assertion.

Since non message views list channel topic list can have a defined
filter, we cannot assume that having `narrow_state.filter` set
implies `message_list.current` is defined.
This commit is contained in:
Aman Agrawal
2025-06-20 11:54:38 +05:30
committed by Tim Abbott
parent 93c4dcbdc9
commit 623fa98976

View File

@@ -26,12 +26,12 @@ function is_URL_hash_same_as_filter_hash(filter: Filter): boolean {
// history, so that we are able to restore it if the user
// navigates back to this page.
function _save_narrow_state(): void {
const current_filter = narrow_state.filter();
if (current_filter === undefined) {
if (message_lists.current === undefined) {
return;
}
assert(message_lists.current !== undefined);
const current_filter = narrow_state.filter();
assert(current_filter !== undefined);
// Only save state if the URL hash matches the filter terms.
if (!is_URL_hash_same_as_filter_hash(current_filter)) {
return;