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 committed Dec 20, 2023
1 parent 4a30e4f commit a908ca9
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 @@ -192,7 +192,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 @@ -333,6 +333,7 @@ export const RequestUrlBar = forwardRef<RequestUrlBarHandle, Props>(({
defaultValue: '3',
submitName: 'Start',
onComplete: seconds => {
sendOrConnect();
setCurrentInterval(+seconds * 1000);
},
})}
Expand Down

0 comments on commit a908ca9

Please sign in to comment.