From c12c4ff05f735e99ff347f861450772d110dcb4b Mon Sep 17 00:00:00 2001 From: zhengjitf Date: Tue, 2 Apr 2024 22:28:23 +0800 Subject: [PATCH] fix: repeat on interval may lead to stay requesting (#6936) --- packages/insomnia/src/ui/components/request-url-bar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/insomnia/src/ui/components/request-url-bar.tsx b/packages/insomnia/src/ui/components/request-url-bar.tsx index 72720cf3851..dcaffcdbabf 100644 --- a/packages/insomnia/src/ui/components/request-url-bar.tsx +++ b/packages/insomnia/src/ui/components/request-url-bar.tsx @@ -190,7 +190,7 @@ export const RequestUrlBar = forwardRef(({ }; }, [sendOrConnect]); - useInterval(sendOrConnect, currentInterval ? currentInterval : null); + useInterval(sendOrConnect, currentInterval && fetcher.state === 'idle' ? currentInterval : null); useTimeoutWhen(sendOrConnect, currentTimeout, !!currentTimeout); const patchRequest = useRequestPatcher(); @@ -327,6 +327,7 @@ export const RequestUrlBar = forwardRef(({ defaultValue: '3', submitName: 'Start', onComplete: seconds => { + sendOrConnect(); setCurrentInterval(+seconds * 1000); }, })}