Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stream_ui_updates: Check if sub/unsub button is rendered.

Aman Agrawalfa9fa9f7f2fa
diff --git a/web/src/stream_ui_updates.js b/web/src/stream_ui_updates.js
index 82756b4d8b0..e298425c3dd 100644
--- a/web/src/stream_ui_updates.js
+++ b/web/src/stream_ui_updates.js
@@ -76,6 +76,12 @@ export function update_settings_button_for_sub(sub) {
// This is for the Subscribe/Unsubscribe button in the right panel.
const $settings_button = stream_settings_ui.settings_button_for_sub(sub);
+
+ if (!$settings_button.length) {
+ // `subscribe` button hasn't been rendered yet while we are processing the event.
+ return;
+ }
+
if (sub.subscribed) {
$settings_button.text($t({defaultMessage: "Unsubscribe"})).removeClass("unsubscribed");
} else {