fix: goose recipe prompt is not shown again when switch the view from settings to chat (#2870)

This commit is contained in:
Lifei Zhou
2025-06-18 09:30:59 +10:00
committed by GitHub
parent 21ea7524f6
commit 5ddb93e7b8
3 changed files with 6 additions and 16 deletions

View File

@@ -8,3 +8,4 @@ src/bin/goose-npm/
/playwright-report/ /playwright-report/
/test-results/ /test-results/
/src/bin/temporal-service /src/bin/temporal-service
src/bin/temporal.db

View File

@@ -105,7 +105,6 @@ const getInitialView = (): ViewConfig => {
export default function App() { export default function App() {
const [fatalError, setFatalError] = useState<string | null>(null); const [fatalError, setFatalError] = useState<string | null>(null);
const [modalVisible, setModalVisible] = useState(false); const [modalVisible, setModalVisible] = useState(false);
const [appInitialized, setAppInitialized] = useState(false);
const [pendingLink, setPendingLink] = useState<string | null>(null); const [pendingLink, setPendingLink] = useState<string | null>(null);
const [modalMessage, setModalMessage] = useState<string>(''); const [modalMessage, setModalMessage] = useState<string>('');
const [extensionConfirmLabel, setExtensionConfirmLabel] = useState<string>(''); const [extensionConfirmLabel, setExtensionConfirmLabel] = useState<string>('');
@@ -207,15 +206,10 @@ export default function App() {
toastService.configure({ silent: false }); toastService.configure({ silent: false });
}; };
(async () => { initializeApp().catch((error) => {
try { console.error('Unhandled error in initialization:', error);
await initializeApp(); setFatalError(`${error instanceof Error ? error.message : 'Unknown error'}`);
setAppInitialized(true); });
} catch (error) {
console.error('Unhandled error in initialization:', error);
setFatalError(`${error instanceof Error ? error.message : 'Unknown error'}`);
}
})();
}, [read, getExtensions, addExtension]); }, [read, getExtensions, addExtension]);
const [isGoosehintsModalOpen, setIsGoosehintsModalOpen] = useState(false); const [isGoosehintsModalOpen, setIsGoosehintsModalOpen] = useState(false);
@@ -515,7 +509,6 @@ export default function App() {
)} )}
{view === 'chat' && !isLoadingSession && ( {view === 'chat' && !isLoadingSession && (
<ChatView <ChatView
readyForAutoUserPrompt={appInitialized}
chat={chat} chat={chat}
setChat={setChat} setChat={setChat}
setView={setView} setView={setView}

View File

@@ -56,13 +56,11 @@ const isUserMessage = (message: Message): boolean => {
}; };
export default function ChatView({ export default function ChatView({
readyForAutoUserPrompt,
chat, chat,
setChat, setChat,
setView, setView,
setIsGoosehintsModalOpen, setIsGoosehintsModalOpen,
}: { }: {
readyForAutoUserPrompt: boolean;
chat: ChatType; chat: ChatType;
setChat: (chat: ChatType) => void; setChat: (chat: ChatType) => void;
setView: (view: View, viewOptions?: ViewOptions) => void; setView: (view: View, viewOptions?: ViewOptions) => void;
@@ -71,7 +69,6 @@ export default function ChatView({
return ( return (
<ChatContextManagerProvider> <ChatContextManagerProvider>
<ChatContent <ChatContent
readyForAutoUserPrompt={readyForAutoUserPrompt}
chat={chat} chat={chat}
setChat={setChat} setChat={setChat}
setView={setView} setView={setView}
@@ -87,7 +84,6 @@ function ChatContent({
setView, setView,
setIsGoosehintsModalOpen, setIsGoosehintsModalOpen,
}: { }: {
readyForAutoUserPrompt: boolean;
chat: ChatType; chat: ChatType;
setChat: (chat: ChatType) => void; setChat: (chat: ChatType) => void;
setView: (view: View, viewOptions?: ViewOptions) => void; setView: (view: View, viewOptions?: ViewOptions) => void;
@@ -628,7 +624,7 @@ function ChatContent({
isLoading={isLoading} isLoading={isLoading}
onStop={onStopGoose} onStop={onStopGoose}
commandHistory={commandHistory} commandHistory={commandHistory}
initialValue={_input || initialPrompt} initialValue={_input || (hasMessages ? _input : initialPrompt)}
setView={setView} setView={setView}
hasMessages={hasMessages} hasMessages={hasMessages}
numTokens={sessionTokenCount} numTokens={sessionTokenCount}