From 06d439e0b2358f06747dfc793942f4be0f678f62 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 30 Dec 2023 16:12:04 -0800 Subject: [PATCH] typing_events: Fix early read of page_params. For spectators, page_params.server_typing_started_expiry_period_milliseconds has not been initialized yet at module load time. Signed-off-by: Anders Kaseorg --- web/src/typing_events.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/typing_events.js b/web/src/typing_events.js index 7c1313909037d..1f05af4efea05 100644 --- a/web/src/typing_events.js +++ b/web/src/typing_events.js @@ -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..." @@ -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); + }, + ); }