fix: unsent text in a new chat is gone after leaving the chat or reloading

Text typed into a new chat but not sent showed up as an empty message box after going to another page and back to New Chat, or after reloading the page, and the empty box then overwrote the saved draft so it could not come back. Now the typed text, including a skill picked with $, comes back in the message box.

Fixes #33397
This commit is contained in:
Classic298 2026-10-30 13:12:46 +01:00
parent 2b1fb53f4d
commit 73cb953836

View file

@ -2768,7 +2768,8 @@
autoScroll = true;
// resetInput() must stay last: the selected model's defaults override the draft's selection.
await restoreChatInput(sessionStorage.getItem('chat-input'));
const restored = await restoreChatInput(sessionStorage.getItem('chat-input'));
const draftPrompt = prompt;
const previousChatId = $chatId;
const previousMessageId = history.currentId;
await resetInput();
@ -2840,6 +2841,8 @@
loading = false;
await tick();
// the input mounts empty once loading ends
if (restored) messageInput?.setText(draftPrompt);
if (modelSearch) await openModelSelectorWithSearch(modelSearch);
// Consume one-shot desktop event (e.g. Spotlight query, call shortcut)