From 76523cdeb308c892063a53d532941a6ce0e0ce35 Mon Sep 17 00:00:00 2001 From: Hetu Nandu Date: Fri, 27 Sep 2024 10:45:22 +0530 Subject: [PATCH] fix: Quick fixes for current state of Plugin Action Editor --- .../components/PluginActionForm/PluginActionForm.tsx | 7 ++++++- .../CommonEditorForm/hooks/useGetFormActionValues.ts | 2 +- .../PluginActionResponse/PluginActionResponse.tsx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx index db91b29b3a2..66ab320a304 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx @@ -2,13 +2,18 @@ import React from "react"; import APIEditorForm from "./components/APIEditorForm"; import { Flex } from "@appsmith/ads"; import { useChangeActionCall } from "./hooks/useChangeActionCall"; +import { usePluginActionContext } from "../../PluginActionContext"; +import { UIComponentTypes } from "api/PluginApi"; const PluginActionForm = () => { useChangeActionCall(); + const { plugin } = usePluginActionContext(); return ( - + {plugin.uiComponent === UIComponentTypes.ApiEditorForm ? ( + + ) : null} ); }; diff --git a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useGetFormActionValues.ts b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useGetFormActionValues.ts index 1078d18282d..da75a1482a2 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useGetFormActionValues.ts +++ b/app/client/src/PluginActionEditor/components/PluginActionForm/components/CommonEditorForm/hooks/useGetFormActionValues.ts @@ -18,7 +18,7 @@ function useGetFormActionValues() { // In an unlikely scenario where form is not initialised, // return empty values to avoid form ui issues - if (!isAPIAction(formValues)) { + if (!formValues || !isAPIAction(formValues)) { return { actionHeaders: [], actionParams: [], diff --git a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx index f20a395d4cb..9359c8130f3 100644 --- a/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx +++ b/app/client/src/PluginActionEditor/components/PluginActionResponse/PluginActionResponse.tsx @@ -57,7 +57,7 @@ function PluginActionResponse() { expandedHeight={`${ActionExecutionResizerHeight}px`} isCollapsed={!open} onSelect={updateSelectedResponseTab} - selectedTabKey={selectedTab || tabs[0].key} + selectedTabKey={selectedTab || tabs[0]?.key} tabs={tabs} />