mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-15 17:25:26 -04:00
Clear the composer draft when entering the New Chat / welcome state (#1408)
Clicking "New chat" (the brand/welcome navigation path) left the previous session's unsent draft in the composer (issue #1343). The direct model-picker path (createDirectChat) already cleared it, but the welcome path did not. Clear `#message` in chatRenderer.showWelcomeScreen() — the shared entry point for that state — resetting its autosized height and dispatching an `input` event so the send button / autosize listeners update. Switching between existing sessions loads them directly and does not call showWelcomeScreen, so genuine drafts are not erased. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1217,6 +1217,17 @@ export function showWelcomeScreen() {
|
||||
const cc = document.getElementById('chat-container');
|
||||
if (ws) ws.classList.remove('hidden');
|
||||
if (cc) cc.classList.add('welcome-active');
|
||||
// Entering the New Chat / welcome state: discard any stale draft left in the
|
||||
// composer from the previous session so the input starts empty (issue #1343).
|
||||
// Switching between existing sessions loads them directly and does NOT call
|
||||
// this, so genuine drafts are not erased. Reset the autosized height and fire
|
||||
// an `input` event so the send button + autosize listeners update.
|
||||
const _msg = document.getElementById('message');
|
||||
if (_msg) {
|
||||
_msg.value = '';
|
||||
_msg.style.height = '';
|
||||
_msg.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
// Re-trigger the L→R clip-wipe reveal on the welcome name each time the
|
||||
// welcome screen is shown (new session, deleted last session, etc.) — without
|
||||
// this, the CSS animation only fires on initial DOM insertion.
|
||||
|
||||
Reference in New Issue
Block a user