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.

popover_menus: Do early return if possible.

Aman Agrawalc3eb17a4114c
diff --git a/web/src/popover_menus.js b/web/src/popover_menus.js
index d5fbd2d3915..6674b06cfe5 100644
--- a/web/src/popover_menus.js
+++ b/web/src/popover_menus.js
@@ -225,6 +225,11 @@ function get_props_for_popover_centering(popover_props) {
// shortcuts and similar alternative ways to open a popover menu.
export function toggle_popover_menu(target, popover_props, options) {
const instance = target._tippy;
+ if (instance) {
+ instance.hide();
+ return;
+ }
+
let mobile_popover_props = {};
// If the window is mobile-sized, we will render the
@@ -235,11 +240,6 @@ export function toggle_popover_menu(target, popover_props, options) {
};
}
- if (instance) {
- instance.hide();
- return;
- }
-
tippy(target, {
...default_popover_props,
showOnCreate: true,