Skip to content

Commit

Permalink
refactor: log error when context menu not found
Browse files Browse the repository at this point in the history
  • Loading branch information
shaokeyibb authored and Enter-tainer committed Sep 8, 2024
1 parent e8057f6 commit b5c11a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,21 @@ const _openContextMenu = ({ el }: { el: HTMLElement }) => {
const contextMenu = el.querySelector(`.review-context-menu`) as
| HTMLDivElement
| undefined;
if (!contextMenu) return;
if (!contextMenu) {
console.error("openContextMenu called but contextMenu not found");
return;
}
contextMenu.style.display = "";
};

const _closeContextMenu = ({ el }: { el: HTMLElement }) => {
const contextMenu = el.querySelector(
`.review-context-menu:not([style*="display: none"])`,
) as HTMLDivElement | undefined;
if (!contextMenu) return;
if (!contextMenu) {
console.error("closeContextMenu called but contextMenu not found");
return;
}
contextMenu.style.display = "none";
};

Expand Down

0 comments on commit b5c11a0

Please sign in to comment.