Improve response history menu (#492)

This commit is contained in:
Gregory Schier
2026-07-02 10:04:57 -07:00
committed by GitHub
parent 9b524e3dc7
commit 95ac3e310a
12 changed files with 351 additions and 75 deletions
@@ -3,10 +3,12 @@ import { copyToClipboard } from "../lib/copy";
import { getResponseBodyText } from "../lib/responseBody";
import { useFastMutation } from "./useFastMutation";
export function useCopyHttpResponse(response: HttpResponse) {
export function useCopyHttpResponse(response: HttpResponse | null) {
return useFastMutation({
mutationKey: ["copy_http_response", response.id],
mutationKey: ["copy_http_response", response?.id],
async mutationFn() {
if (response == null) return;
const body = await getResponseBodyText({ response, filter: null });
copyToClipboard(body);
},