Compare commits

...

1 Commits

Author SHA1 Message Date
Jiang Bohan
eca24a6b0e fix(views): use createSafeId in custom args tab
crypto.randomUUID() is only defined in secure contexts, so self-hosted
HTTP deployments were throwing TypeError on mount and when clicking Add.
Route the id generation through the existing createSafeId() helper so
the tab works in non-secure contexts too.

Fixes #1214
2026-04-17 13:38:07 +08:00

View File

@@ -8,6 +8,7 @@ import {
Trash2,
} from "lucide-react";
import type { Agent } from "@multica/core/types";
import { createSafeId } from "@multica/core/utils";
import { Button } from "@multica/ui/components/ui/button";
import { Input } from "@multica/ui/components/ui/input";
import { Label } from "@multica/ui/components/ui/label";
@@ -19,7 +20,7 @@ interface ArgEntry {
}
function argsToEntries(args: string[]): ArgEntry[] {
return args.map((value) => ({ id: crypto.randomUUID(), value }));
return args.map((value) => ({ id: createSafeId(), value }));
}
function entriesToArgs(entries: ArgEntry[]): string[] {
@@ -43,7 +44,7 @@ export function CustomArgsTab({
const dirty = JSON.stringify(currentArgs) !== JSON.stringify(originalArgs);
const addEntry = () => {
setEntries([...entries, { id: crypto.randomUUID(), value: "" }]);
setEntries([...entries, { id: createSafeId(), value: "" }]);
};
const removeEntry = (index: number) => {