From ba207ad00b176d22e39a3dbf7adc402e6ec10438 Mon Sep 17 00:00:00 2001 From: Abhijit Balaji Date: Thu, 2 Apr 2026 10:50:37 -0400 Subject: [PATCH] fix(ui): resolve build errors and unused variable warnings - Fixed 'refreshStatic' use-before-declaration in AppContainer.tsx. - Removed unused 'version' and 'showHeaderDetails' variables in MainContent.tsx. - Cleaned up unused 'useAppContext' import in MainContent.tsx. - This commit ensures the branch builds successfully after the sticky topic header implementation. --- packages/cli/src/ui/AppContainer.tsx | 24 +++++++++---------- .../cli/src/ui/components/MainContent.tsx | 4 ---- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index 7d4cdfb335..eae74dbbc7 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -257,18 +257,6 @@ export const AppContainer = (props: AppContainerProps) => { return topic || summary ? { title: topic, summary } : null; }); - useEffect(() => { - const handleTopicUpdated = (payload: { title?: string; summary?: string }) => { - setCurrentTopic({ title: payload.title, summary: payload.summary }); - refreshStatic(); - }; - - coreEvents.on(CoreEvent.TopicUpdated, handleTopicUpdated); - return () => { - coreEvents.off(CoreEvent.TopicUpdated, handleTopicUpdated); - }; - }, [refreshStatic]); - const [adminSettingsChanged, setAdminSettingsChanged] = useState(false); const [expandedTools, setExpandedTools] = useState>(new Set()); @@ -698,6 +686,18 @@ export const AppContainer = (props: AppContainerProps) => { } }, [bannerVisible, bannerText, settings, config, refreshStatic]); + useEffect(() => { + const handleTopicUpdated = (payload: { title?: string; summary?: string }) => { + setCurrentTopic({ title: payload.title, summary: payload.summary }); + refreshStatic(); + }; + + coreEvents.on(CoreEvent.TopicUpdated, handleTopicUpdated); + return () => { + coreEvents.off(CoreEvent.TopicUpdated, handleTopicUpdated); + }; + }, [refreshStatic]); + const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } = useSettingsCommand(); diff --git a/packages/cli/src/ui/components/MainContent.tsx b/packages/cli/src/ui/components/MainContent.tsx index b3733eed13..7e4d5a3aaa 100644 --- a/packages/cli/src/ui/components/MainContent.tsx +++ b/packages/cli/src/ui/components/MainContent.tsx @@ -8,7 +8,6 @@ import { Box, Static } from 'ink'; import { HistoryItemDisplay } from './HistoryItemDisplay.js'; import { useUIState } from '../contexts/UIStateContext.js'; import { useSettings } from '../contexts/SettingsContext.js'; -import { useAppContext } from '../contexts/AppContext.js'; import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js'; import { @@ -29,7 +28,6 @@ const MemoizedHistoryItemDisplay = memo(HistoryItemDisplay); // This threshold is arbitrary but should be high enough to never impact normal // usage. export const MainContent = () => { - const { version } = useAppContext(); const uiState = useUIState(); const isAlternateBuffer = useAlternateBuffer(); @@ -50,9 +48,7 @@ export const MainContent = () => { mainAreaWidth, staticAreaMaxItemHeight, availableTerminalHeight, - cleanUiDetailsVisible, } = uiState; - const showHeaderDetails = cleanUiDetailsVisible; const lastUserPromptIndex = useMemo(() => { for (let i = uiState.history.length - 1; i >= 0; i--) {