Prevent conditional loading of ChatView; bug fixes

This commit is contained in:
Saoud Rizwan
2024-07-10 05:48:22 -04:00
parent fc9b1435fd
commit fa2669802d
3 changed files with 35 additions and 14 deletions

View File

@@ -65,16 +65,20 @@ const App: React.FC = () => {
<>
{showWelcome ? (
<WelcomeView apiKey={apiKey} setApiKey={setApiKey} />
) : showSettings ? (
<SettingsView
apiKey={apiKey}
setApiKey={setApiKey}
maxRequestsPerTask={maxRequestsPerTask}
setMaxRequestsPerTask={setMaxRequestsPerTask}
onDone={() => setShowSettings(false)}
/>
) : (
<ChatView messages={claudeMessages} />
<>
{showSettings && (
<SettingsView
apiKey={apiKey}
setApiKey={setApiKey}
maxRequestsPerTask={maxRequestsPerTask}
setMaxRequestsPerTask={setMaxRequestsPerTask}
onDone={() => setShowSettings(false)}
/>
)}
{/* Do not conditionally load ChatView, it's expensive and there's state we don't want to lose (user input, disableInput, askResponse promise, etc.) */}
<ChatView messages={claudeMessages} isHidden={showSettings} />
</>
)}
</>
)