mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:37 +01:00
Fix performance related to having 100s of requests (#123)
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import type { HttpResponse } from '@yaakapp-internal/models';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { getHttpRequest } from '../lib/store';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useActiveCookieJar } from './useActiveCookieJar';
|
||||
import { useActiveEnvironment } from './useActiveEnvironment';
|
||||
import { useAlert } from './useAlert';
|
||||
import { useHttpRequests } from './useHttpRequests';
|
||||
|
||||
export function useSendAnyHttpRequest() {
|
||||
const [environment] = useActiveEnvironment();
|
||||
const alert = useAlert();
|
||||
const [environment] = useActiveEnvironment();
|
||||
const [activeCookieJar] = useActiveCookieJar();
|
||||
const requests = useHttpRequests();
|
||||
return useMutation<HttpResponse | null, string, string | null>({
|
||||
mutationKey: ['send_any_request'],
|
||||
mutationFn: async (id) => {
|
||||
const request = requests.find((r) => r.id === id) ?? null;
|
||||
const request = await getHttpRequest(id);
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user