diff options
| author | Allen Hutchison <[email protected]> | 2025-05-06 16:20:28 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-06 16:20:28 -0700 |
| commit | 7d13f242887f4204a2c8a0ca719e121621472db9 (patch) | |
| tree | 726ae6bae16cea90a8ae5754ace083bbf8162b5b /packages/cli/src/ui/App.tsx | |
| parent | adeda6a5b35faddacc4c4b251fbc8f809a4a2758 (diff) | |
refactor(cli): Centralize history management via useHistoryManager hook (#261)
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
| -rw-r--r-- | packages/cli/src/ui/App.tsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 30eb49bd..e14cea62 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -27,6 +27,7 @@ import { HistoryItemDisplay } from './components/HistoryItemDisplay.js'; import { useCompletion } from './hooks/useCompletion.js'; import { SuggestionsDisplay } from './components/SuggestionsDisplay.js'; import { isAtCommand, isSlashCommand } from './utils/commandUtils.js'; +import { useHistory } from './hooks/useHistoryManager.js'; interface AppProps { config: Config; @@ -35,7 +36,7 @@ interface AppProps { } export const App = ({ config, settings, cliVersion }: AppProps) => { - const [history, setHistory] = useState<HistoryItem[]>([]); + const { history, addItem, updateItem, clearItems } = useHistory(); const [startupWarnings, setStartupWarnings] = useState<string[]>([]); const [showHelp, setShowHelp] = useState<boolean>(false); const { @@ -57,7 +58,9 @@ export const App = ({ config, settings, cliVersion }: AppProps) => { debugMessage, slashCommands, } = useGeminiStream( - setHistory, + addItem, + updateItem, + clearItems, refreshStatic, setShowHelp, config, |
