Skip to content

Commit

Permalink
remove callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
gatzjames committed Jun 5, 2024
1 parent c083acc commit 5a4c436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ export const RequestHeadersEditor: FC<Props> = ({
headersString += `${header.name}: ${header.value}\n`;
}

const handleChange = useCallback((headers: RequestHeader[]) => patcher(id, { headers }), [id, patcher]);

if (bulk) {
return (
<div className="tall">
Expand All @@ -101,7 +99,7 @@ export const RequestHeadersEditor: FC<Props> = ({
pairs={headers}
handleGetAutocompleteNameConstants={getCommonHeaderNames}
handleGetAutocompleteValueConstants={getCommonHeaderValues}
onChange={handleChange}
onChange={headers => patcher(id, { headers })}
isDisabled={isDisabled}
readOnlyPairs={isWebSocketRequest ? readOnlyWebsocketPairs : readOnlyHttpPairs}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -144,8 +144,6 @@ export const GrpcRequestPane: FunctionComponent<Props> = ({
request_send: handleRequestSend,
});

const handleHeadersChange = useCallback((metadata: GrpcRequestHeader[]) => patchRequest(requestId, { metadata }), [patchRequest, requestId]);

return (
<>
<Pane type="request">
Expand Down Expand Up @@ -320,7 +318,7 @@ export const GrpcRequestPane: FunctionComponent<Props> = ({
isDisabled={running}
handleGetAutocompleteNameConstants={getCommonHeaderNames}
handleGetAutocompleteValueConstants={getCommonHeaderValues}
onChange={handleHeadersChange}
onChange={(metadata: GrpcRequestHeader[]) => patchRequest(requestId, { metadata })}
/>
</ErrorBoundary>
</PanelContainer>
Expand Down

0 comments on commit 5a4c436

Please sign in to comment.