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.

tippyjs: Fix traceback on reaction tooltip.

Aman Agrawal48addae20b00
diff --git a/static/js/tippyjs.js b/static/js/tippyjs.js
index b16246378a1..aaead568822 100644
--- a/static/js/tippyjs.js
+++ b/static/js/tippyjs.js
@@ -65,6 +65,15 @@ export function initialize() {
// We target the message table and check for removal of it, it's children
// and the reactions individually down in the subtree.
const target_node = elem.parents(".message_table.focused_table").get(0);
+ if (!target_node) {
+ // The `reaction` was removed from DOM before we reached here.
+ // In that case, we simply hide the tooltip.
+ // We have to be smart about hiding the instance, so we hide it as soon
+ // as it is displayed.
+ setTimeout(instance.hide, 0);
+ return;
+ }
+
const nodes_to_check_for_removal = [
elem.parents(".recipient_row").get(0),
elem.parents(".message_reactions").get(0),
@@ -87,7 +96,9 @@ export function initialize() {
},
onHidden(instance) {
instance.destroy();
- observer.disconnect();
+ if (observer) {
+ observer.disconnect();
+ }
},
appendTo: () => document.body,
});