mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-29 05:31:51 +02:00
Fix performance related to having 100s of requests (#123)
This commit is contained in:
14
src-web/hooks/useSendManyRequests.ts
Normal file
14
src-web/hooks/useSendManyRequests.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { useSendAnyHttpRequest } from './useSendAnyHttpRequest';
|
||||
|
||||
export function useSendManyRequests() {
|
||||
const sendAnyRequest = useSendAnyHttpRequest();
|
||||
return useMutation<void, string, string[]>({
|
||||
mutationKey: ['send_many_requests'],
|
||||
mutationFn: async (requestIds: string[]) => {
|
||||
for (const id of requestIds) {
|
||||
sendAnyRequest.mutate(id);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user