Skip to content

Commit 53999f3

Browse files
committed
fix(ui): packResult not changed when regenerate
1 parent 42faa78 commit 53999f3

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

web/bun.lockb

0 Bytes
Binary file not shown.

web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@radix-ui/react-tabs": "^1.1.3",
3939
"@radix-ui/react-tooltip": "^1.1.8",
4040
"@tailwindcss/vite": "^4.0.7",
41-
"@tanstack/react-query": "^5.66.7",
41+
"@tanstack/react-query": "^5.66.8",
4242
"@tanstack/react-router": "^1.106.0",
4343
"@tanstack/router-devtools": "^1.106.0",
4444
"class-variance-authority": "^0.7.1",
@@ -51,7 +51,7 @@
5151
"react-hook-form": "^7.54.2",
5252
"react-i18next": "^15.4.1",
5353
"react-syntax-highlighter": "^15.6.1",
54-
"sonner": "^2.0.0",
54+
"sonner": "^2.0.1",
5555
"tailwind-merge": "^3.0.1",
5656
"tailwind-scrollbar": "^4.0.0",
5757
"tailwindcss-animate": "^1.0.7",

web/src/components/shell-result.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
} from "@/types/shell.ts";
3030
import { TFunction } from "i18next";
3131
import { CircleHelpIcon, FileTextIcon, ScrollTextIcon, TriangleAlertIcon } from "lucide-react";
32-
import { Fragment, useState } from "react";
32+
import { Fragment, useEffect, useState } from "react";
3333
import { useTranslation } from "react-i18next";
3434
import { toast } from "sonner";
3535

@@ -280,6 +280,14 @@ function MultiPackResult({
280280
const packMethods = Object.keys(allPackResults ?? {});
281281
const [selectedMethod, setSelectedMethod] = useState(packMethods[0]);
282282
const [packResult, setPackResult] = useState(allPackResults?.[selectedMethod as keyof typeof allPackResults] ?? "");
283+
284+
useEffect(() => {
285+
const methods = Object.keys(allPackResults ?? {});
286+
const firstMethod = methods[0];
287+
setSelectedMethod(firstMethod);
288+
setPackResult(allPackResults?.[firstMethod as keyof typeof allPackResults] ?? "");
289+
}, [allPackResults]);
290+
283291
return (
284292
<Fragment>
285293
<CodeViewer

0 commit comments

Comments
 (0)