summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/App.tsx
diff options
context:
space:
mode:
authorAllen Hutchison <[email protected]>2025-05-07 12:30:32 -0700
committerGitHub <[email protected]>2025-05-07 12:30:32 -0700
commit6b3ef9f93986a6c5f892b5f011b25b6826e522a1 (patch)
tree3af7fda7863a72a27185b48630dad2e3526337d9 /packages/cli/src/ui/App.tsx
parent46490263123bf855c40da35ef8be62f2b9b134b2 (diff)
Refactor: Enhance @-command, Autocomplete, and Input Stability (#279)
Diffstat (limited to 'packages/cli/src/ui/App.tsx')
-rw-r--r--packages/cli/src/ui/App.tsx29
1 files changed, 18 insertions, 11 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index e14cea62..1c1ec424 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -96,17 +96,8 @@ export const App = ({ config, settings, cliVersion }: AppProps) => {
const isInputActive = streamingState === StreamingState.Idle && !initError;
- const {
- query,
- setQuery,
- handleSubmit: handleHistorySubmit,
- inputKey,
- setInputKey,
- } = useInputHistory({
- userMessages,
- onSubmit: handleFinalSubmit,
- isActive: isInputActive,
- });
+ // query and setQuery are now managed by useState here
+ const [query, setQuery] = useState('');
const completion = useCompletion(
query,
@@ -115,6 +106,22 @@ export const App = ({ config, settings, cliVersion }: AppProps) => {
slashCommands,
);
+ const {
+ handleSubmit: handleHistorySubmit,
+ inputKey,
+ setInputKey,
+ } = useInputHistory({
+ userMessages,
+ onSubmit: (value) => {
+ // Adapt onSubmit to use the lifted setQuery
+ handleFinalSubmit(value);
+ setQuery(''); // Clear query from the App's state
+ },
+ isActive: isInputActive && !completion.showSuggestions,
+ query,
+ setQuery,
+ });
+
// --- Render Logic ---
const { staticallyRenderedHistoryItems, updatableHistoryItems } =