diff --git a/app/client/src/components/editorComponents/ApiResponseView.tsx b/app/client/src/components/editorComponents/ApiResponseView.tsx index 7bb2a4849f..1b03260fde 100644 --- a/app/client/src/components/editorComponents/ApiResponseView.tsx +++ b/app/client/src/components/editorComponents/ApiResponseView.tsx @@ -9,6 +9,7 @@ import { AppState } from "../../reducers"; import CodeEditor from "./CodeEditor"; import { ActionResponse } from "../../api/ActionAPI"; import { formatBytes } from "../../utils/helpers"; +import { APIEditorRouteParams } from "constants/routes"; const ResponseWrapper = styled.div` position: relative; @@ -91,10 +92,27 @@ const ResponseHeadersView = (props: { data: Record }) => { ); }; -type Props = ReduxStateProps & RouteComponentProps<{ id: string }>; +type Props = ReduxStateProps & RouteComponentProps; + +const EMPTY_RESPONSE = { + statusCode: "", + duration: "", + body: {}, + headers: {}, + size: "", +}; const ApiResponseView = (props: Props) => { - const response = props.responses[props.match.params.id] || {}; + const { + match: { + params: { apiId }, + }, + responses, + } = props; + let response: ActionResponse = EMPTY_RESPONSE; + if (apiId && apiId in responses) { + response = responses[apiId]; + } return ( {props.isRunning && Sending Request} diff --git a/app/client/src/components/propertyControls/InputTextControl.tsx b/app/client/src/components/propertyControls/InputTextControl.tsx index d3c37d7727..ac39e6b6c7 100644 --- a/app/client/src/components/propertyControls/InputTextControl.tsx +++ b/app/client/src/components/propertyControls/InputTextControl.tsx @@ -1,5 +1,4 @@ import React from "react"; -import _ from "lodash"; import BaseControl, { ControlProps } from "./BaseControl"; import { ControlWrapper, StyledInputGroup } from "./StyledControls"; import { InputType } from "../../widgets/InputWidget";