Skip to content

Commit

Permalink
fix: repeat on interval may lead to stay requesting
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjitf authored and filfreire committed Mar 27, 2024
1 parent ada2414 commit 64528fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/insomnia/src/ui/components/request-url-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const RequestUrlBar = forwardRef<RequestUrlBarHandle, Props>(({
};
}, [sendOrConnect]);

useInterval(sendOrConnect, currentInterval ? currentInterval : null);
useInterval(sendOrConnect, currentInterval && fetcher.state === 'idle' ? currentInterval : null);
useTimeoutWhen(sendOrConnect, currentTimeout, !!currentTimeout);
const patchRequest = useRequestPatcher();

Expand Down Expand Up @@ -327,6 +327,7 @@ export const RequestUrlBar = forwardRef<RequestUrlBarHandle, Props>(({
defaultValue: '3',
submitName: 'Start',
onComplete: seconds => {
sendOrConnect();
setCurrentInterval(+seconds * 1000);
},
})}
Expand Down

0 comments on commit 64528fd

Please sign in to comment.