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.

playground_popover: Fix bug where the playground popover doesn't reopen.

Sayam Samal5191a80a3af6
diff --git a/web/src/playground_links_popover.ts b/web/src/playground_links_popover.ts
index 1ab82a20403..f6eff373f7b 100644
--- a/web/src/playground_links_popover.ts
+++ b/web/src/playground_links_popover.ts
@@ -12,7 +12,7 @@ import * as ui_util from "./ui_util";
type RealmPlaygroundWithURL = RealmPlayground & {playground_url: string};
-let playground_links_popover_instance: tippy.Instance;
+let playground_links_popover_instance: tippy.Instance | null = null;
// Playground_store contains all the data we need to generate a popover of
// playground links for each code block. The element is the target element
@@ -63,16 +63,19 @@ export function is_open(): boolean {
}
export function hide(): void {
- if (is_open()) {
- $(playground_links_popover_instance.reference)
- .parent()
- .removeClass("active-playground-links-reference");
- playground_links_popover_instance.destroy();
+ if (!playground_links_popover_instance) {
+ return;
}
+
+ $(playground_links_popover_instance.reference)
+ .parent()
+ .removeClass("active-playground-links-reference");
+ playground_links_popover_instance.destroy();
+ playground_links_popover_instance = null;
}
function get_playground_links_popover_items(): JQuery | undefined {
- if (!is_open()) {
+ if (!playground_links_popover_instance) {
blueslip.error("Trying to get menu items when playground links popover is closed.");
return undefined;
}