From 85146206f60a22385ed27dae30d4f00e7e2675eb Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 21 Sep 2026 00:59:46 -0400 Subject: [PATCH] refac --- .../components/layout/Sidebar/ChatItem.svelte | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/components/layout/Sidebar/ChatItem.svelte b/src/lib/components/layout/Sidebar/ChatItem.svelte index 0eb704955f..54eba10ef3 100644 --- a/src/lib/components/layout/Sidebar/ChatItem.svelte +++ b/src/lib/components/layout/Sidebar/ChatItem.svelte @@ -400,12 +400,20 @@ let showDeleteConfirm = false; const chatTitleInputKeydownHandler = (e) => { + // Let Enter and Escape finish IME composition without saving or cancelling the rename. + if (e.isComposing || e.keyCode === 229) { + return; + } + if (e.key === 'Enter') { e.preventDefault(); - setTimeout(() => { - const input = document.getElementById(`chat-title-input-${id}`); - if (input) input.blur(); - }, 0); + + if (chatTitle !== title) { + editChatTitle(id, chatTitle); + } + + confirmEdit = false; + chatTitle = ''; } else if (e.key === 'Escape') { e.preventDefault(); confirmEdit = false;