Skip to content

Commit

Permalink
typing_events: Fix early read of page_params.
Browse files Browse the repository at this point in the history
For spectators,
page_params.server_typing_started_expiry_period_milliseconds has not
been initialized yet at module load time.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
  • Loading branch information
andersk authored and timabbott committed Jan 2, 2024
1 parent 45c8dcc commit 06d439e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions web/src/typing_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import * as typing_data from "./typing_data";
//
// We also handle the local event of re-narrowing.
// (For the outbound code, see typing.js.)
//
// How long before we assume a client has gone away
// and expire the active typing indicator.
const typing_started_expiry_period = page_params.server_typing_started_expiry_period_milliseconds;

// If number of users typing exceed this,
// we render "Several people are typing..."
Expand Down Expand Up @@ -115,7 +111,11 @@ export function display_notification(event) {

render_notifications_for_narrow();

typing_data.kickstart_inbound_timer(key, typing_started_expiry_period, () => {
hide_notification(event);
});
typing_data.kickstart_inbound_timer(
key,
page_params.server_typing_started_expiry_period_milliseconds,
() => {
hide_notification(event);
},
);
}

0 comments on commit 06d439e

Please sign in to comment.