diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.test.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.test.tsx
new file mode 100644
index 000000000000..07c891977152
--- /dev/null
+++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.test.tsx
@@ -0,0 +1,22 @@
+import React from "react";
+import { getActions } from "./PropertyPaneView";
+
+describe("getActions", () => {
+ const mockOnCopy = jest.fn();
+ const mockOnDelete = jest.fn();
+ beforeEach(() => {
+ jest.clearAllMocks();
+ });
+
+ it("should return an empty array when widget type is CONTAINER_WIDGET", () => {
+ const widgetProperties = { type: "CONTAINER_WIDGET" };
+ const actions = getActions(widgetProperties, mockOnCopy, mockOnDelete);
+ expect(actions).toEqual([]);
+ });
+
+ it("should returns actions array when widget type is not CONTAINER_WIDGET", () => {
+ const widgetProperties = { type: "LIST_WIDGET_V2" };
+ const actions = getActions(widgetProperties, mockOnCopy, mockOnDelete);
+ expect(actions).toHaveLength(2);
+ });
+});
diff --git a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
index 3d3af93c5edb..ffc6847910e1 100644
--- a/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
+++ b/app/client/src/pages/Editor/PropertyPane/PropertyPaneView.tsx
@@ -72,6 +72,43 @@ export const excludeList: WidgetType[] = [
"WDS_BUTTON_WIDGET",
"WDS_TABLE_WIDGET",
];
+export function getActions(
+ widgetProperties: any,
+ onCopy: () => void,
+ onDelete: () => void
+): Array<{
+ tooltipContent: any;
+ icon: ReactElement;
+}> {
+ return widgetProperties?.type === "CONTAINER_WIDGET"
+ ? []
+ : [
+ {
+ tooltipContent: "Copy widget",
+ icon: (
+
+ ),
+ },
+ {
+ tooltipContent: "Delete widget",
+ icon: (
+
+ ),
+ },
+ ];
+}
function PropertyPaneView(
props: {
@@ -208,39 +245,11 @@ function PropertyPaneView(
/**
* actions shown on the right of title
*/
- const actions = useMemo((): Array<{
- // TODO: Fix this the next time the file is edited
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- tooltipContent: any;
- icon: ReactElement;
- }> => {
- return [
- {
- tooltipContent: "Copy widget",
- icon: (
-
- ),
- },
- {
- tooltipContent: "Delete widget",
- icon: (
-
- ),
- },
- ];
- }, [onCopy, onDelete]);
+ const actions = useMemo(
+ () => getActions(widgetProperties, onCopy, onDelete),
+ [onCopy, onDelete, widgetProperties]
+ );
+
useEffect(() => {
setSearchText("");