From 00606028e3fb382b15d6815877756fab6b889a86 Mon Sep 17 00:00:00 2001 From: Frank Schumacher Date: Tue, 14 Nov 2023 15:07:56 +0100 Subject: [PATCH] fix prompt being shown twice Reason (as I can see it): The interpolation of the request params is done twice. Both interpolations were called using the context RENDER_PURPOSE_RENDER which triggers the prompt in `local-template-tags.ts`. This file contains the "prompt" function as a plugin. `context.app.prompt` is called there without checking for the already set cached value when context === "send". This "fix" renders the first time with renderPurpose set to "no-render" so no prompt is called in this case since no plugins (the "prompt") are called anyway. --- packages/insomnia/src/ui/components/request-url-bar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/insomnia/src/ui/components/request-url-bar.tsx b/packages/insomnia/src/ui/components/request-url-bar.tsx index 84076bb43..e0be3a933 100644 --- a/packages/insomnia/src/ui/components/request-url-bar.tsx +++ b/packages/insomnia/src/ui/components/request-url-bar.tsx @@ -4,7 +4,7 @@ import { useFetcher, useParams, useRouteLoaderData } from 'react-router-dom'; import { useInterval } from 'react-use'; import styled from 'styled-components'; -import { RENDER_PURPOSE_SEND } from '../../common/render'; +import { RENDER_PURPOSE_NO_RENDER } from '../../common/render'; import * as models from '../../models'; import { isEventStreamRequest } from '../../models/request'; import { fetchRequestData, tryToInterpolateRequest, tryToTransformRequestWithPlugins } from '../../network/network'; @@ -144,7 +144,7 @@ export const RequestUrlBar = forwardRef(({ const { request, environment } = await fetchRequestData(requestId); - const renderResult = await tryToInterpolateRequest(request, environment._id, RENDER_PURPOSE_SEND); + const renderResult = await tryToInterpolateRequest(request, environment._id, RENDER_PURPOSE_NO_RENDER); // ARCHY NOTE: HERE IS SEND const renderedRequest = await tryToTransformRequestWithPlugins(renderResult); renderedRequest && send({