From 5a4c43688fbda7b61dd569034377db090a2d0455 Mon Sep 17 00:00:00 2001 From: gatzjames Date: Wed, 5 Jun 2024 09:17:36 +0200 Subject: [PATCH] remove callbacks --- .../src/ui/components/editors/request-headers-editor.tsx | 4 +--- .../insomnia/src/ui/components/panes/grpc-request-pane.tsx | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/insomnia/src/ui/components/editors/request-headers-editor.tsx b/packages/insomnia/src/ui/components/editors/request-headers-editor.tsx index 2eaf81769320..27524021bb30 100644 --- a/packages/insomnia/src/ui/components/editors/request-headers-editor.tsx +++ b/packages/insomnia/src/ui/components/editors/request-headers-editor.tsx @@ -78,8 +78,6 @@ export const RequestHeadersEditor: FC = ({ headersString += `${header.name}: ${header.value}\n`; } - const handleChange = useCallback((headers: RequestHeader[]) => patcher(id, { headers }), [id, patcher]); - if (bulk) { return (
@@ -101,7 +99,7 @@ export const RequestHeadersEditor: FC = ({ pairs={headers} handleGetAutocompleteNameConstants={getCommonHeaderNames} handleGetAutocompleteValueConstants={getCommonHeaderValues} - onChange={handleChange} + onChange={headers => patcher(id, { headers })} isDisabled={isDisabled} readOnlyPairs={isWebSocketRequest ? readOnlyWebsocketPairs : readOnlyHttpPairs} /> diff --git a/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx b/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx index 696c9b29cb4e..16902818e434 100644 --- a/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx +++ b/packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx @@ -1,4 +1,4 @@ -import React, { FunctionComponent, useCallback, useRef, useState } from 'react'; +import React, { FunctionComponent, useRef, useState } from 'react'; import { useParams, useRouteLoaderData } from 'react-router-dom'; import { useMount } from 'react-use'; import styled from 'styled-components'; @@ -144,8 +144,6 @@ export const GrpcRequestPane: FunctionComponent = ({ request_send: handleRequestSend, }); - const handleHeadersChange = useCallback((metadata: GrpcRequestHeader[]) => patchRequest(requestId, { metadata }), [patchRequest, requestId]); - return ( <> @@ -320,7 +318,7 @@ export const GrpcRequestPane: FunctionComponent = ({ isDisabled={running} handleGetAutocompleteNameConstants={getCommonHeaderNames} handleGetAutocompleteValueConstants={getCommonHeaderValues} - onChange={handleHeadersChange} + onChange={(metadata: GrpcRequestHeader[]) => patchRequest(requestId, { metadata })} />