diff --git a/src/hooks/useAPI.ts b/src/hooks/useAPI.ts index 5b6fc05..f83b5dd 100644 --- a/src/hooks/useAPI.ts +++ b/src/hooks/useAPI.ts @@ -124,11 +124,17 @@ export function useMutationAPI() { endpoint: string; body: object | undefined | null; }) => callEndpoint(method, endpoint, body), - onMutate: () => { - queryClient.invalidateQueries(); + onMutate: ({ method, endpoint }) => { + queryClient.resetQueries({ + queryKey: ['GET', endpoint], + force: true, + }); }, - onSuccess: () => { - queryClient.invalidateQueries(); + onSuccess: (data, { method, endpoint }) => { + queryClient.resetQueries({ + queryKey: ['GET', endpoint], + force: true, + }); }, }); } diff --git a/src/pages/homepage/components/Search/Search.tsx b/src/pages/homepage/components/Search/Search.tsx index cab0ef6..276deaa 100644 --- a/src/pages/homepage/components/Search/Search.tsx +++ b/src/pages/homepage/components/Search/Search.tsx @@ -101,7 +101,7 @@ export default function Search({ endpoint: 'api/searchHistory', body: { prefix: providerPrefix, provider: providerLabel, searchTerm: subtext }, }).then(() => { - open(`${providerURL}${subtext}`, '_self'); + open(`${providerURL}${subtext}`); }); } }