Kaynağa Gözat

Use structuredClone instead of remeda's clone (#14351)

Co-authored-by: Dax Raad <[email protected]>
Co-authored-by: Dax <[email protected]>
Michael Hart 2 ay önce
ebeveyn
işleme
f73698b8fc

+ 1 - 2
packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx

@@ -3,7 +3,6 @@ import { Global } from "@/global"
 import { Filesystem } from "@/util/filesystem"
 import { onMount } from "solid-js"
 import { createStore, produce } from "solid-js/store"
-import { clone } from "remeda"
 import { createSimpleContext } from "../../context/helper"
 import { appendFile, writeFile } from "fs/promises"
 import type { AgentPart, FilePart, TextPart } from "@opencode-ai/sdk/v2"
@@ -83,7 +82,7 @@ export const { use: usePromptHistory, provider: PromptHistoryProvider } = create
         return store.history.at(store.index)
       },
       append(item: PromptInfo) {
-        const entry = clone(item)
+        const entry = structuredClone(item)
         let trimmed = false
         setStore(
           produce((draft) => {

+ 1 - 2
packages/opencode/src/cli/cmd/tui/component/prompt/stash.tsx

@@ -3,7 +3,6 @@ import { Global } from "@/global"
 import { Filesystem } from "@/util/filesystem"
 import { onMount } from "solid-js"
 import { createStore, produce } from "solid-js/store"
-import { clone } from "remeda"
 import { createSimpleContext } from "../../context/helper"
 import { appendFile, writeFile } from "fs/promises"
 import type { PromptInfo } from "./history"
@@ -53,7 +52,7 @@ export const { use: usePromptStash, provider: PromptStashProvider } = createSimp
         return store.entries
       },
       push(entry: Omit<StashEntry, "timestamp">) {
-        const stash = clone({ ...entry, timestamp: Date.now() })
+        const stash = structuredClone({ ...entry, timestamp: Date.now() })
         let trimmed = false
         setStore(
           produce((draft) => {