fix: deep copy settings when duplicating an engine (#907)

This commit is contained in:
dualfroz committed 2026-09-26 09:42:46 +02:00
1 parent 3b3d5ed500
commit 01c5621cdb
3 files changed
+59 -5

No files matched your search

+2 -5
View File
@@ -44,6 +44,7 @@ import { commands } from "@/bindings";
import { Route } from "@/routes/engines";
import { enginesAtom } from "@/state/atoms";
import {
duplicateEngine,
type Engine,
engineSchema,
type LocalEngine,
@@ -566,11 +567,7 @@ function EngineSettings({
leftSection={<IconCopy size="1rem" />}
variant="default"
onClick={() => {
const duplicatedEngine: LocalEngine = {
...engine,
id: crypto.randomUUID(),
name: `${engine.name} (Copy)`,
};
const duplicatedEngine = duplicateEngine(engine);
setEngines(async (prev) => {
const copy = [...(await prev)];
copy.splice(selected + 1, 0, duplicatedEngine);