diff --git a/app/client/src/pages/Editor/Explorer/Actions/MoreActionsMenu.tsx b/app/client/src/pages/Editor/Explorer/Actions/MoreActionsMenu.tsx
index 2625fb0448..996b9aa318 100644
--- a/app/client/src/pages/Editor/Explorer/Actions/MoreActionsMenu.tsx
+++ b/app/client/src/pages/Editor/Explorer/Actions/MoreActionsMenu.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useState } from "react";
+import React, { useCallback, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import type { AppState } from "@appsmith/reducers";
@@ -44,6 +44,10 @@ export function MoreActionsMenu(props: EntityContextMenuProps) {
const [confirmDelete, setConfirmDelete] = useState(false);
const { isChangePermitted = false, isDeletePermitted = false } = props;
+ useEffect(() => {
+ if (!isMenuOpen) setConfirmDelete(false);
+ }, [isMenuOpen]);
+
const dispatch = useDispatch();
const copyActionToPage = useCallback(
(actionId: string, actionName: string, pageId: string) =>
diff --git a/app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx b/app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx
index e9a34b00fe..e17099456c 100644
--- a/app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx
+++ b/app/client/src/pages/Editor/JSEditor/AppJSEditorContextMenu.tsx
@@ -181,7 +181,13 @@ export function AppJSEditorContextMenu({
if (isDeletePermitted) options.push(deleteOption);
return (
-
+ {
+ setConfirmDelete(false);
+ }}
+ options={options}
+ />
);
}
diff --git a/app/client/src/pages/Editor/JSEditor/JSEditorContextMenu.tsx b/app/client/src/pages/Editor/JSEditor/JSEditorContextMenu.tsx
index a15fc3527f..d868d8805d 100644
--- a/app/client/src/pages/Editor/JSEditor/JSEditorContextMenu.tsx
+++ b/app/client/src/pages/Editor/JSEditor/JSEditorContextMenu.tsx
@@ -27,17 +27,26 @@ export interface ContextMenuOption {
interface EntityContextMenuProps {
className?: string;
options: ContextMenuOption[];
+ onMenuClose: (() => void) | undefined;
}
export function JSEditorContextMenu({
className,
+ onMenuClose,
options,
}: EntityContextMenuProps) {
if (options.length === 0) {
return null;
}
return (
-