Skip to content

Commit 8805dfc

Browse files
committed
fix: deduplicate prompt history entries
Avoid adding duplicate entries to prompt history when the same input is appended multiple times (e.g., clearing with ctrl+c then restoring via history navigation and clearing again).
1 parent ac5a5d8 commit 8805dfc

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/component/prompt

packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const { use: usePromptHistory, provider: PromptHistoryProvider } = create
8282
return store.history.at(store.index)
8383
},
8484
append(item: PromptInfo) {
85+
if (store.history.at(-1)?.input === item.input) return
8586
const entry = clone(item)
8687
let trimmed = false
8788
setStore(

0 commit comments

Comments
 (0)