fix: history up arrow

This commit is contained in:
Brooklyn Nicholson 2026-04-07 20:47:59 -05:00
parent 2d884ff12d
commit af077b2c0d

View file

@ -7,14 +7,7 @@ export function useInputHistory() {
const [historyIdx, setHistoryIdx] = useState<number | null>(null)
const historyDraftRef = useRef('')
const pushHistory = (text: string) => {
const trimmed = text.trim()
if (trimmed && historyRef.current.at(-1) !== trimmed) {
historyRef.current.push(trimmed)
inputHistory.append(trimmed)
}
}
const pushHistory = (text: string) => inputHistory.append(text)
return { historyRef, historyIdx, setHistoryIdx, historyDraftRef, pushHistory }
}