diff --git a/package-lock.json b/package-lock.json index 13ac8a2b..72b2f8b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ }, "devDependencies": { "@tailwindcss/nesting": "^0.0.0-insiders.565cd3e", - "@tanstack/react-query-devtools": "^5.35.5", + "@tanstack/react-query-devtools": "^5.45.1", "@tauri-apps/cli": ">=2.0.0-beta.0", "@types/node": "^18.7.10", "@types/papaparse": "^5.3.7", @@ -2290,10 +2290,19 @@ "postcss": "^8.2.15" } }, + "node_modules/@tanstack/query-core": { + "version": "5.45.0", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.45.0.tgz", + "integrity": "sha512-RVfIZQmFUTdjhSAAblvueimfngYyfN6HlwaJUPK71PKd7yi43Vs1S/rdimmZedPWX/WGppcq/U1HOj7O7FwYxw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@tanstack/query-devtools": { - "version": "5.32.1", - "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.32.1.tgz", - "integrity": "sha512-7Xq57Ctopiy/4atpb0uNY5VRuCqRS/1fi/WBCKKX6jHMa6cCgDuV/AQuiwRXcKARbq2OkVAOrW2v4xK9nTbcCA==", + "version": "5.37.1", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.37.1.tgz", + "integrity": "sha512-XcG4IIHIv0YQKrexTqo2zogQWR1Sz672tX2KsfE9kzB+9zhx44vRKH5si4WDILE1PIWQpStFs/NnrDQrBAUQpg==", "dev": true, "funding": { "type": "github", @@ -2301,11 +2310,11 @@ } }, "node_modules/@tanstack/react-query": { - "version": "5.35.5", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.35.5.tgz", - "integrity": "sha512-sppX7L+PVn5GBV3In6zzj0zcKfnZRKhXbX1MfIfKo1OjIq2GMaopvAFOP0x1bRYTUk2ikrdYcQYOozX7PWkb8A==", + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.45.1.tgz", + "integrity": "sha512-mYYfJujKg2kxmkRRjA6nn4YKG3ITsKuH22f1kteJ5IuVQqgKUgbaSQfYwVP0gBS05mhwxO03HVpD0t7BMN7WOA==", "dependencies": { - "@tanstack/query-core": "5.35.5" + "@tanstack/query-core": "5.45.0" }, "funding": { "type": "github", @@ -2316,29 +2325,20 @@ } }, "node_modules/@tanstack/react-query-devtools": { - "version": "5.35.5", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.35.5.tgz", - "integrity": "sha512-4Xll14B9uhgEJ+uqZZ5tqZ7G1LDR7wGYgb+NOZHGn11TTABnlV8GWon7zDMqdaHeR5mjjuY1UFo9pbz39kuZKQ==", + "version": "5.45.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.45.1.tgz", + "integrity": "sha512-4mrbk1g5jqlqh0pifZNsKzy7FtgeqgwzMICL4d6IJGayrrcrKq9K4N/OzRNbgRWrTn6YTY63qcAcKo+NJU2QMw==", "dev": true, "dependencies": { - "@tanstack/query-devtools": "5.32.1" + "@tanstack/query-devtools": "5.37.1" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^5.35.5", - "react": "^18.0.0" - } - }, - "node_modules/@tanstack/react-query/node_modules/@tanstack/query-core": { - "version": "5.35.5", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.35.5.tgz", - "integrity": "sha512-OMWvlEqG01RfGj+XZb/piDzPp0eZkkHWSDHt2LvE/fd1zWburP/xwm0ghk6Iv8cuPlP+ACFkZviKXK0OVt6lhg==", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/tannerlinsley" + "@tanstack/react-query": "^5.45.1", + "react": "^18 || ^19" } }, "node_modules/@tauri-apps/api": { diff --git a/package.json b/package.json index 0fc171ae..9fc8b048 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ }, "devDependencies": { "@tailwindcss/nesting": "^0.0.0-insiders.565cd3e", - "@tanstack/react-query-devtools": "^5.35.5", + "@tanstack/react-query-devtools": "^5.45.1", "@tauri-apps/cli": ">=2.0.0-beta.0", "@types/node": "^18.7.10", "@types/papaparse": "^5.3.7", diff --git a/src-web/components/App.tsx b/src-web/components/App.tsx index 35cec5e9..1959d2b2 100644 --- a/src-web/components/App.tsx +++ b/src-web/components/App.tsx @@ -20,7 +20,7 @@ const queryClient = new QueryClient({ export function App() { return ( - + diff --git a/src-web/hooks/useCancelHttpResponse.ts b/src-web/hooks/useCancelHttpResponse.ts index 073e752d..1fb670fc 100644 --- a/src-web/hooks/useCancelHttpResponse.ts +++ b/src-web/hooks/useCancelHttpResponse.ts @@ -4,6 +4,7 @@ import { trackEvent } from '../lib/analytics'; export function useCancelHttpResponse(id: string | null) { return useMutation({ + mutationKey: ['cancel_http_response', id], mutationFn: () => event.emit(`cancel_http_response_${id}`), onSettled: () => trackEvent('http_response', 'cancel'), }); diff --git a/src-web/hooks/useCheckForUpdates.tsx b/src-web/hooks/useCheckForUpdates.tsx index 51dadb9d..a3bd62d7 100644 --- a/src-web/hooks/useCheckForUpdates.tsx +++ b/src-web/hooks/useCheckForUpdates.tsx @@ -9,6 +9,7 @@ export function useCheckForUpdates() { const alert = useAlert(); const appInfo = useAppInfo(); return useMutation({ + mutationKey: ['check_for_updates'], mutationFn: async () => { const hasUpdate: boolean = await minPromiseMillis(invokeCmd('cmd_check_for_updates'), 500); if (!hasUpdate) { diff --git a/src-web/hooks/useCreateCookieJar.ts b/src-web/hooks/useCreateCookieJar.ts index 1a1fa241..5054b618 100644 --- a/src-web/hooks/useCreateCookieJar.ts +++ b/src-web/hooks/useCreateCookieJar.ts @@ -12,6 +12,7 @@ export function useCreateCookieJar() { const prompt = usePrompt(); return useMutation({ + mutationKey: ['create_cookie_jar'], mutationFn: async () => { if (workspaceId === null) { throw new Error("Cannot create cookie jar when there's no active workspace"); diff --git a/src-web/hooks/useCreateEnvironment.ts b/src-web/hooks/useCreateEnvironment.ts index f6679711..0eff8dfd 100644 --- a/src-web/hooks/useCreateEnvironment.ts +++ b/src-web/hooks/useCreateEnvironment.ts @@ -14,6 +14,7 @@ export function useCreateEnvironment() { const queryClient = useQueryClient(); return useMutation({ + mutationKey: ['create_environment'], mutationFn: async () => { const name = await prompt({ id: 'new-environment', diff --git a/src-web/hooks/useCreateFolder.ts b/src-web/hooks/useCreateFolder.ts index 5fa9c1cc..e2f0129c 100644 --- a/src-web/hooks/useCreateFolder.ts +++ b/src-web/hooks/useCreateFolder.ts @@ -14,6 +14,7 @@ export function useCreateFolder() { const prompt = usePrompt(); return useMutation>>({ + mutationKey: ['create_folder'], mutationFn: async (patch) => { if (workspaceId === null) { throw new Error("Cannot create folder when there's no active workspace"); diff --git a/src-web/hooks/useCreateGrpcRequest.ts b/src-web/hooks/useCreateGrpcRequest.ts index 31e1db94..88c33af9 100644 --- a/src-web/hooks/useCreateGrpcRequest.ts +++ b/src-web/hooks/useCreateGrpcRequest.ts @@ -18,6 +18,7 @@ export function useCreateGrpcRequest() { unknown, Partial> >({ + mutationKey: ['create_grpc_request'], mutationFn: (patch) => { if (workspaceId === null) { throw new Error("Cannot create grpc request when there's no active workspace"); diff --git a/src-web/hooks/useCreateHttpRequest.ts b/src-web/hooks/useCreateHttpRequest.ts index 9bb3b3b9..6b11e2b7 100644 --- a/src-web/hooks/useCreateHttpRequest.ts +++ b/src-web/hooks/useCreateHttpRequest.ts @@ -14,6 +14,7 @@ export function useCreateHttpRequest() { const routes = useAppRoutes(); return useMutation>({ + mutationKey: ['create_http_request'], mutationFn: (patch = {}) => { if (workspaceId === null) { throw new Error("Cannot create request when there's no active workspace"); diff --git a/src-web/hooks/useCreateWorkspace.ts b/src-web/hooks/useCreateWorkspace.ts index 6fa4a8cf..1fdf963a 100644 --- a/src-web/hooks/useCreateWorkspace.ts +++ b/src-web/hooks/useCreateWorkspace.ts @@ -8,6 +8,7 @@ export function useCreateWorkspace() { const routes = useAppRoutes(); const prompt = usePrompt(); return useMutation({ + mutationKey: ['create_workspace'], mutationFn: async () => { const name = await prompt({ id: 'new-workspace', diff --git a/src-web/hooks/useDeleteAnyGrpcRequest.tsx b/src-web/hooks/useDeleteAnyGrpcRequest.tsx index 84d65664..6131816f 100644 --- a/src-web/hooks/useDeleteAnyGrpcRequest.tsx +++ b/src-web/hooks/useDeleteAnyGrpcRequest.tsx @@ -13,6 +13,7 @@ export function useDeleteAnyGrpcRequest() { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_any_grpc_request'], mutationFn: async (id) => { const request = await getGrpcRequest(id); if (request == null) return null; diff --git a/src-web/hooks/useDeleteAnyHttpRequest.tsx b/src-web/hooks/useDeleteAnyHttpRequest.tsx index a9c41a6e..3af23b85 100644 --- a/src-web/hooks/useDeleteAnyHttpRequest.tsx +++ b/src-web/hooks/useDeleteAnyHttpRequest.tsx @@ -14,6 +14,7 @@ export function useDeleteAnyHttpRequest() { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_any_http_request'], mutationFn: async (id) => { const request = await getHttpRequest(id); if (request == null) return null; diff --git a/src-web/hooks/useDeleteCookieJar.tsx b/src-web/hooks/useDeleteCookieJar.tsx index e95389ed..27572482 100644 --- a/src-web/hooks/useDeleteCookieJar.tsx +++ b/src-web/hooks/useDeleteCookieJar.tsx @@ -11,6 +11,7 @@ export function useDeleteCookieJar(cookieJar: CookieJar | null) { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_cookie_jar', cookieJar?.id], mutationFn: async () => { const confirmed = await confirm({ id: 'delete-cookie-jar', diff --git a/src-web/hooks/useDeleteEnvironment.tsx b/src-web/hooks/useDeleteEnvironment.tsx index c4d626dd..8623456d 100644 --- a/src-web/hooks/useDeleteEnvironment.tsx +++ b/src-web/hooks/useDeleteEnvironment.tsx @@ -11,6 +11,7 @@ export function useDeleteEnvironment(environment: Environment | null) { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_environment', environment?.id], mutationFn: async () => { const confirmed = await confirm({ id: 'delete-environment', diff --git a/src-web/hooks/useDeleteFolder.tsx b/src-web/hooks/useDeleteFolder.tsx index e03f98e4..48d6c0c0 100644 --- a/src-web/hooks/useDeleteFolder.tsx +++ b/src-web/hooks/useDeleteFolder.tsx @@ -13,6 +13,7 @@ export function useDeleteFolder(id: string | null) { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_folder', id], mutationFn: async () => { const folder = await getFolder(id); const confirmed = await confirm({ diff --git a/src-web/hooks/useDeleteGrpcConnection.ts b/src-web/hooks/useDeleteGrpcConnection.ts index e877a95e..02a1a2d5 100644 --- a/src-web/hooks/useDeleteGrpcConnection.ts +++ b/src-web/hooks/useDeleteGrpcConnection.ts @@ -7,6 +7,7 @@ import { grpcConnectionsQueryKey } from './useGrpcConnections'; export function useDeleteGrpcConnection(id: string | null) { const queryClient = useQueryClient(); return useMutation({ + mutationKey: ['delete_grpc_connection', id], mutationFn: async () => { return await invokeCmd('cmd_delete_grpc_connection', { id: id }); }, diff --git a/src-web/hooks/useDeleteGrpcConnections.ts b/src-web/hooks/useDeleteGrpcConnections.ts index 416a0772..296b8aef 100644 --- a/src-web/hooks/useDeleteGrpcConnections.ts +++ b/src-web/hooks/useDeleteGrpcConnections.ts @@ -6,6 +6,7 @@ import { grpcConnectionsQueryKey } from './useGrpcConnections'; export function useDeleteGrpcConnections(requestId?: string) { const queryClient = useQueryClient(); return useMutation({ + mutationKey: ['delete_grpc_connections', requestId], mutationFn: async () => { if (requestId === undefined) return; await invokeCmd('cmd_delete_all_grpc_connections', { requestId }); diff --git a/src-web/hooks/useDeleteHttpResponse.ts b/src-web/hooks/useDeleteHttpResponse.ts index 25f82201..e4b9b473 100644 --- a/src-web/hooks/useDeleteHttpResponse.ts +++ b/src-web/hooks/useDeleteHttpResponse.ts @@ -7,6 +7,7 @@ import { httpResponsesQueryKey } from './useHttpResponses'; export function useDeleteHttpResponse(id: string | null) { const queryClient = useQueryClient(); return useMutation({ + mutationKey: ['delete_http_response', id], mutationFn: async () => { return await invokeCmd('cmd_delete_http_response', { id: id }); }, diff --git a/src-web/hooks/useDeleteHttpResponses.ts b/src-web/hooks/useDeleteHttpResponses.ts index 291f1dfc..cc21dd9e 100644 --- a/src-web/hooks/useDeleteHttpResponses.ts +++ b/src-web/hooks/useDeleteHttpResponses.ts @@ -6,6 +6,7 @@ import { httpResponsesQueryKey } from './useHttpResponses'; export function useDeleteHttpResponses(requestId?: string) { const queryClient = useQueryClient(); return useMutation({ + mutationKey: ['delete_http_responses', requestId], mutationFn: async () => { if (requestId === undefined) return; await invokeCmd('cmd_delete_all_http_responses', { requestId }); diff --git a/src-web/hooks/useDeleteRequest.tsx b/src-web/hooks/useDeleteRequest.tsx index 2be14c85..d1ea9d64 100644 --- a/src-web/hooks/useDeleteRequest.tsx +++ b/src-web/hooks/useDeleteRequest.tsx @@ -7,6 +7,7 @@ export function useDeleteRequest(id: string | null) { const deleteAnyGrpcRequest = useDeleteAnyGrpcRequest(); return useMutation({ + mutationKey: ['delete_request', id], mutationFn: async () => { if (id == null) return; // We don't know what type it is based on the ID, so just try deleting both diff --git a/src-web/hooks/useDeleteWorkspace.tsx b/src-web/hooks/useDeleteWorkspace.tsx index 39de3936..c0d5d13c 100644 --- a/src-web/hooks/useDeleteWorkspace.tsx +++ b/src-web/hooks/useDeleteWorkspace.tsx @@ -16,6 +16,7 @@ export function useDeleteWorkspace(workspace: Workspace | null) { const confirm = useConfirm(); return useMutation({ + mutationKey: ['delete_workspace', workspace?.id], mutationFn: async () => { const confirmed = await confirm({ id: 'delete-workspace', diff --git a/src-web/hooks/useDuplicateGrpcRequest.ts b/src-web/hooks/useDuplicateGrpcRequest.ts index 8db63d47..9b45af86 100644 --- a/src-web/hooks/useDuplicateGrpcRequest.ts +++ b/src-web/hooks/useDuplicateGrpcRequest.ts @@ -20,6 +20,7 @@ export function useDuplicateGrpcRequest({ const routes = useAppRoutes(); const protoFiles = useGrpcProtoFiles(id); return useMutation({ + mutationKey: ['duplicate_grpc_request', id], mutationFn: async () => { if (id === null) throw new Error("Can't duplicate a null grpc request"); return invokeCmd('cmd_duplicate_grpc_request', { id }); diff --git a/src-web/hooks/useDuplicateHttpRequest.ts b/src-web/hooks/useDuplicateHttpRequest.ts index 20c9fb3a..5b80a356 100644 --- a/src-web/hooks/useDuplicateHttpRequest.ts +++ b/src-web/hooks/useDuplicateHttpRequest.ts @@ -17,6 +17,7 @@ export function useDuplicateHttpRequest({ const activeEnvironmentId = useActiveEnvironmentId(); const routes = useAppRoutes(); return useMutation({ + mutationKey: ['duplicate_http_request', id], mutationFn: async () => { if (id === null) throw new Error("Can't duplicate a null request"); return invokeCmd('cmd_duplicate_http_request', { id }); diff --git a/src-web/hooks/useExportData.tsx b/src-web/hooks/useExportData.tsx index c1305b96..cb552015 100644 --- a/src-web/hooks/useExportData.tsx +++ b/src-web/hooks/useExportData.tsx @@ -14,6 +14,7 @@ export function useExportData() { const toast = useToast(); return useMutation({ + mutationKey: ['export_data'], onError: (err: string) => { alert({ id: 'export-failed', title: 'Export Failed', body: err }); }, diff --git a/src-web/hooks/useGrpc.ts b/src-web/hooks/useGrpc.ts index 60a0c25f..24a1cf53 100644 --- a/src-web/hooks/useGrpc.ts +++ b/src-web/hooks/useGrpc.ts @@ -21,12 +21,14 @@ export function useGrpc( const environmentId = useActiveEnvironmentId(); const go = useMutation({ + mutationKey: ['grpc_go', conn?.id], mutationFn: async () => await invokeCmd('cmd_grpc_go', { requestId, environmentId, protoFiles }), onSettled: () => trackEvent('grpc_request', 'send'), }); const send = useMutation({ + mutationKey: ['grpc_send', conn?.id], mutationFn: async ({ message }: { message: string }) => await emit(`grpc_client_msg_${conn?.id ?? 'none'}`, { Message: message }), onSettled: () => trackEvent('grpc_connection', 'send'), diff --git a/src-web/hooks/useImportCurl.ts b/src-web/hooks/useImportCurl.ts index 15bac81d..f2ddfd53 100644 --- a/src-web/hooks/useImportCurl.ts +++ b/src-web/hooks/useImportCurl.ts @@ -16,6 +16,7 @@ export function useImportCurl({ clearClipboard }: { clearClipboard?: boolean } = const [, setClipboardText] = useClipboardText(); return useMutation({ + mutationKey: ['import_curl'], mutationFn: async ({ requestId, command }: { requestId: string | null; command: string }) => { const request: Record = await invokeCmd('cmd_curl_to_request', { command, diff --git a/src-web/hooks/useImportData.tsx b/src-web/hooks/useImportData.tsx index 3eeec7b6..c1678d04 100644 --- a/src-web/hooks/useImportData.tsx +++ b/src-web/hooks/useImportData.tsx @@ -77,6 +77,7 @@ export function useImportData() { }; return useMutation({ + mutationKey: ['import_data'], onError: (err: string) => { alert({ id: 'import-failed', diff --git a/src-web/hooks/useKeyValue.ts b/src-web/hooks/useKeyValue.ts index 7f21d3c9..69ba44b7 100644 --- a/src-web/hooks/useKeyValue.ts +++ b/src-web/hooks/useKeyValue.ts @@ -32,6 +32,7 @@ export function useKeyValue({ }); const mutate = useMutation({ + mutationKey: ['set_key_value', namespace, key], mutationFn: (value) => setKeyValue({ namespace, key, value }), // k/v should be as fast as possible, so optimistically update the cache onMutate: (value) => queryClient.setQueryData(keyValueQueryKey({ namespace, key }), value), diff --git a/src-web/hooks/useMoveToWorkspace.tsx b/src-web/hooks/useMoveToWorkspace.tsx index 1e5a28b6..654b44ae 100644 --- a/src-web/hooks/useMoveToWorkspace.tsx +++ b/src-web/hooks/useMoveToWorkspace.tsx @@ -12,7 +12,7 @@ export function useMoveToWorkspace(id: string) { const activeWorkspaceId = useActiveWorkspaceId(); return useMutation({ - mutationKey: ['moveWorkspace'], + mutationKey: ['move_workspace', id], mutationFn: async () => { if (request == null || activeWorkspaceId == null) return; diff --git a/src-web/hooks/useOpenWorkspace.ts b/src-web/hooks/useOpenWorkspace.ts index 0762ea6e..3870675e 100644 --- a/src-web/hooks/useOpenWorkspace.ts +++ b/src-web/hooks/useOpenWorkspace.ts @@ -8,6 +8,7 @@ export function useOpenWorkspace() { const routes = useAppRoutes(); return useMutation({ + mutationKey: ['open_workspace'], mutationFn: async ({ workspaceId, inNewWindow, diff --git a/src-web/hooks/useSaveResponse.tsx b/src-web/hooks/useSaveResponse.tsx index 8f2fea12..2d3b7928 100644 --- a/src-web/hooks/useSaveResponse.tsx +++ b/src-web/hooks/useSaveResponse.tsx @@ -13,6 +13,7 @@ export function useSaveResponse(response: HttpResponse) { const toast = useToast(); return useMutation({ + mutationKey: ['save_response', response.id], mutationFn: async () => { const request = await getHttpRequest(response.requestId); if (request == null) return null; diff --git a/src-web/hooks/useSendAnyRequest.ts b/src-web/hooks/useSendAnyRequest.ts index 9e83c931..88490c13 100644 --- a/src-web/hooks/useSendAnyRequest.ts +++ b/src-web/hooks/useSendAnyRequest.ts @@ -14,6 +14,7 @@ export function useSendAnyRequest(options: { download?: boolean } = {}) { const alert = useAlert(); const { activeCookieJar } = useActiveCookieJar(); return useMutation({ + mutationKey: ['send_any_request'], mutationFn: async (id) => { const request = await getHttpRequest(id); if (request == null) { diff --git a/src-web/hooks/useSendFolder.ts b/src-web/hooks/useSendFolder.ts index 454bca6a..b4cc80fb 100644 --- a/src-web/hooks/useSendFolder.ts +++ b/src-web/hooks/useSendFolder.ts @@ -4,6 +4,7 @@ import { useSendAnyRequest } from './useSendAnyRequest'; export function useSendManyRequests() { const sendAnyRequest = useSendAnyRequest(); return useMutation({ + mutationKey: ['send_many_requests'], mutationFn: async (requestIds: string[]) => { for (const id of requestIds) { sendAnyRequest.mutate(id); diff --git a/src-web/hooks/useSendRequest.ts b/src-web/hooks/useSendRequest.ts index 4f498a6c..89ecd710 100644 --- a/src-web/hooks/useSendRequest.ts +++ b/src-web/hooks/useSendRequest.ts @@ -5,6 +5,7 @@ import { useSendAnyRequest } from './useSendAnyRequest'; export function useSendRequest(id: string | null, options: { download?: boolean } = {}) { const sendAnyRequest = useSendAnyRequest(options); return useMutation({ + mutationKey: ['send_http_request', id], mutationFn: () => sendAnyRequest.mutateAsync(id), }); } diff --git a/src-web/hooks/useUpdateAnyFolder.ts b/src-web/hooks/useUpdateAnyFolder.ts index f0bd057f..4ad57baa 100644 --- a/src-web/hooks/useUpdateAnyFolder.ts +++ b/src-web/hooks/useUpdateAnyFolder.ts @@ -8,6 +8,7 @@ export function useUpdateAnyFolder() { const queryClient = useQueryClient(); return useMutation Folder }>({ + mutationKey: ['update_any_folder'], mutationFn: async ({ id, update }) => { const folder = await getFolder(id); if (folder === null) { diff --git a/src-web/hooks/useUpdateAnyGrpcRequest.ts b/src-web/hooks/useUpdateAnyGrpcRequest.ts index ce3c6e17..97db5d5d 100644 --- a/src-web/hooks/useUpdateAnyGrpcRequest.ts +++ b/src-web/hooks/useUpdateAnyGrpcRequest.ts @@ -12,6 +12,7 @@ export function useUpdateAnyGrpcRequest() { unknown, { id: string; update: Partial | ((r: GrpcRequest) => GrpcRequest) } >({ + mutationKey: ['update_any_grpc_request'], mutationFn: async ({ id, update }) => { const request = await getGrpcRequest(id); if (request === null) { diff --git a/src-web/hooks/useUpdateAnyHttpRequest.ts b/src-web/hooks/useUpdateAnyHttpRequest.ts index 2a25fa69..dbe8bb6b 100644 --- a/src-web/hooks/useUpdateAnyHttpRequest.ts +++ b/src-web/hooks/useUpdateAnyHttpRequest.ts @@ -12,6 +12,7 @@ export function useUpdateAnyHttpRequest() { unknown, { id: string; update: Partial | ((r: HttpRequest) => HttpRequest) } >({ + mutationKey: ['update_any_http_request'], mutationFn: async ({ id, update }) => { const request = await getHttpRequest(id); if (request === null) { diff --git a/src-web/hooks/useUpdateCookieJar.ts b/src-web/hooks/useUpdateCookieJar.ts index b93de842..7f28e600 100644 --- a/src-web/hooks/useUpdateCookieJar.ts +++ b/src-web/hooks/useUpdateCookieJar.ts @@ -7,6 +7,7 @@ import { cookieJarsQueryKey } from './useCookieJars'; export function useUpdateCookieJar(id: string | null) { const queryClient = useQueryClient(); return useMutation | ((j: CookieJar) => CookieJar)>({ + mutationKey: ['update_cookie_jar', id], mutationFn: async (v) => { const cookieJar = await getCookieJar(id); if (cookieJar == null) { diff --git a/src-web/hooks/useUpdateEnvironment.ts b/src-web/hooks/useUpdateEnvironment.ts index d75886e2..a798ca6f 100644 --- a/src-web/hooks/useUpdateEnvironment.ts +++ b/src-web/hooks/useUpdateEnvironment.ts @@ -7,6 +7,7 @@ import { environmentsQueryKey } from './useEnvironments'; export function useUpdateEnvironment(id: string | null) { const queryClient = useQueryClient(); return useMutation | ((r: Environment) => Environment)>({ + mutationKey: ['update_environment', id], mutationFn: async (v) => { const environment = await getEnvironment(id); if (environment == null) { diff --git a/src-web/hooks/useUpdateGrpcRequest.ts b/src-web/hooks/useUpdateGrpcRequest.ts index 4f05f14e..315ad703 100644 --- a/src-web/hooks/useUpdateGrpcRequest.ts +++ b/src-web/hooks/useUpdateGrpcRequest.ts @@ -5,6 +5,7 @@ import { useUpdateAnyGrpcRequest } from './useUpdateAnyGrpcRequest'; export function useUpdateGrpcRequest(id: string | null) { const updateAnyGrpcRequest = useUpdateAnyGrpcRequest(); return useMutation | ((r: GrpcRequest) => GrpcRequest)>({ + mutationKey: ['update_grpc_request', id], mutationFn: async (update) => { return updateAnyGrpcRequest.mutateAsync({ id: id ?? 'n/a', update }); }, diff --git a/src-web/hooks/useUpdateHttpRequest.ts b/src-web/hooks/useUpdateHttpRequest.ts index 3a4faee7..dabb49d5 100644 --- a/src-web/hooks/useUpdateHttpRequest.ts +++ b/src-web/hooks/useUpdateHttpRequest.ts @@ -5,6 +5,7 @@ import { useUpdateAnyHttpRequest } from './useUpdateAnyHttpRequest'; export function useUpdateHttpRequest(id: string | null) { const updateAnyRequest = useUpdateAnyHttpRequest(); return useMutation | ((r: HttpRequest) => HttpRequest)>({ + mutationKey: ['update_http_request', id], mutationFn: async (update) => updateAnyRequest.mutateAsync({ id: id ?? 'n/a', update }), }); } diff --git a/src-web/hooks/useUpdateSettings.ts b/src-web/hooks/useUpdateSettings.ts index ba81d197..d3a4888c 100644 --- a/src-web/hooks/useUpdateSettings.ts +++ b/src-web/hooks/useUpdateSettings.ts @@ -7,6 +7,7 @@ export function useUpdateSettings() { const settings = useSettings(); return useMutation>({ + mutationKey: ['update_settings'], mutationFn: async (patch) => { if (settings == null) return; const newSettings: Settings = { ...settings, ...patch }; diff --git a/src-web/hooks/useUpdateWorkspace.ts b/src-web/hooks/useUpdateWorkspace.ts index cf2d6697..cf772814 100644 --- a/src-web/hooks/useUpdateWorkspace.ts +++ b/src-web/hooks/useUpdateWorkspace.ts @@ -7,6 +7,7 @@ import { workspacesQueryKey } from './useWorkspaces'; export function useUpdateWorkspace(id: string | null) { const queryClient = useQueryClient(); return useMutation | ((w: Workspace) => Workspace)>({ + mutationKey: ['update_workspace', id], mutationFn: async (v) => { const workspace = await getWorkspace(id); if (workspace == null) {