fix(ui): packResult not changed when regenerate

This commit is contained in:
ReaJason
2025-02-20 22:28:34 +08:00
parent 42faa786cb
commit 53999f3e71
3 changed files with 11 additions and 3 deletions
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -38,7 +38,7 @@
"@radix-ui/react-tabs": "^1.1.3",
"@radix-ui/react-tooltip": "^1.1.8",
"@tailwindcss/vite": "^4.0.7",
"@tanstack/react-query": "^5.66.7",
"@tanstack/react-query": "^5.66.8",
"@tanstack/react-router": "^1.106.0",
"@tanstack/router-devtools": "^1.106.0",
"class-variance-authority": "^0.7.1",
@@ -51,7 +51,7 @@
"react-hook-form": "^7.54.2",
"react-i18next": "^15.4.1",
"react-syntax-highlighter": "^15.6.1",
"sonner": "^2.0.0",
"sonner": "^2.0.1",
"tailwind-merge": "^3.0.1",
"tailwind-scrollbar": "^4.0.0",
"tailwindcss-animate": "^1.0.7",
+9 -1
View File
@@ -29,7 +29,7 @@ import {
} from "@/types/shell.ts";
import { TFunction } from "i18next";
import { CircleHelpIcon, FileTextIcon, ScrollTextIcon, TriangleAlertIcon } from "lucide-react";
import { Fragment, useState } from "react";
import { Fragment, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
@@ -280,6 +280,14 @@ function MultiPackResult({
const packMethods = Object.keys(allPackResults ?? {});
const [selectedMethod, setSelectedMethod] = useState(packMethods[0]);
const [packResult, setPackResult] = useState(allPackResults?.[selectedMethod as keyof typeof allPackResults] ?? "");
useEffect(() => {
const methods = Object.keys(allPackResults ?? {});
const firstMethod = methods[0];
setSelectedMethod(firstMethod);
setPackResult(allPackResults?.[firstMethod as keyof typeof allPackResults] ?? "");
}, [allPackResults]);
return (
<Fragment>
<CodeViewer