specators: Fix persistent recent topics loading indicator.

This unfortunately requires somewhat ugly duplicated code, but I think
it's the best option for now.

I expect we will somewhat soon work on the transition to no longer
have two duplicate fetches here, and doing so will let us remove this
secondary code path.

Fixes #21304.
This commit is contained in:
Tim Abbott 2022-03-04 15:47:57 -08:00
parent 2644fa9645
commit 5ee5a7e635
1 changed files with 10 additions and 0 deletions

View File

@ -431,6 +431,12 @@ export function initialize(home_view_loaded) {
}
if (data.found_newest) {
if (page_params.is_spectator) {
// Since for spectators, this is the main fetch, we
// hide the Recent Topics loading indicator here.
recent_topics_ui.hide_loading_indicator();
}
// See server_events.js for this callback.
home_view_loaded();
start_backfilling_messages();
@ -472,6 +478,10 @@ export function initialize(home_view_loaded) {
if (page_params.is_spectator) {
// Since spectators never have old unreads, we can skip the
// hacky fetch below for them (which would just waste resources).
// This optimization requires a bit of duplicated loading
// indicator code, here and hiding logic in hide_more.
recent_topics_ui.show_loading_indicator();
return;
}