Skip to content

Commit

Permalink
fix: record grpc method (Kong#7999)
Browse files Browse the repository at this point in the history
  • Loading branch information
CurryYangxx authored Sep 24, 2024
1 parent be43da6 commit eca6766
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions packages/insomnia/src/ui/components/panes/grpc-request-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,24 @@ export const GrpcRequestPane: FunctionComponent<Props> = ({
const [isProtoModalOpen, setIsProtoModalOpen] = useState(false);
const { requestMessages, running, methods } = grpcState;
useMount(async () => {
if (!activeRequest.protoFileId) {
return;
if (activeRequest.protoFileId) {
console.log(`[gRPC] loading proto file methods pf=${activeRequest.protoFileId}`);
const methods = await window.main.grpc.loadMethods(activeRequest.protoFileId);
setGrpcState({ ...grpcState, methods });
} else {
const rendered =
await tryToInterpolateRequestOrShowRenderErrorModal({
request: activeRequest,
environmentId,
payload: {
url: activeRequest.url,
metadata: activeRequest.metadata,
reflectionApi: activeRequest.reflectionApi,
},
});
const methods = await window.main.grpc.loadMethodsFromReflection(rendered);
setGrpcState({ ...grpcState, methods });
}
console.log(`[gRPC] loading proto file methods pf=${activeRequest.protoFileId}`);
const methods = await window.main.grpc.loadMethods(activeRequest.protoFileId);
setGrpcState({ ...grpcState, methods });
});
const editorRef = useRef<CodeEditorHandle>(null);
const gitVersion = useGitVCSVersion();
Expand Down

0 comments on commit eca6766

Please sign in to comment.