fix(desktop): CJK IME Enter blocked — draft never updates during composition#44208
Open
questionjie-max wants to merge 1 commit into
Open
fix(desktop): CJK IME Enter blocked — draft never updates during composition#44208questionjie-max wants to merge 1 commit into
questionjie-max wants to merge 1 commit into
Conversation
Contributor
|
The diff shows the entire 1,830-line replaced with a single base64-encoded line. The committed file appears to be binary-encoded rather than valid TypeScript/TSX source. This will cause:
The file needs to be re-committed as plain text source. This typically happens when:
Please re-commit the file with the intended source code changes, then the review can proceed. |
…osition Two interacting problems prevented CJK IME users from sending messages via Enter in the desktop composer: 1. handleEditorInput skipped draft updates when composingRef was true, so the React draft state stayed empty during IME typing. This meant hasComposerPayload was always false — the Send button never appeared, and the submit path had nothing to send. 2. (Upstream already fixed) submitDraft() now uses draftRef.current Fixes: - Remove the composingRef guard from handleEditorInput. Draft now updates during IME composition so the Send button appears as soon as text is in the editor. The Enter guard in handleEditorKeyDown still blocks premature submission via event.nativeEvent.isComposing. - Add imeEnterRef to track Enter during IME composition. On compositionend, if set, the committed text is synced from the DOM into state and submitDraft() is scheduled — CJK users get one-Enter send instead of needing a second Enter. - Self-heal stale composition flag: clear composingRef on keydown when nativeEvent.isComposing is false, and reset on blur unconditionally (upstream fix from NousResearch#44149 applied locally). Closes NousResearch#44135
5422f9c to
f8f949b
Compare
Author
|
Fixed — the PR branch was rebuilt from upstream/main. The diff now shows only the actual changes (45 additions, 8 deletions, 1 file). Ready for re-review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #44135 — CJK IME users cannot send messages via Enter in the desktop composer.
Root Cause
Three remaining gaps after #39614 (which added
flushEditorToDraftand removed thecomposingRefguard):handleEditorInputleft as no-op — after thecomposingRefguard was removed, the function body was empty. Draft state was never synced on input events, so the Send button stayed hidden during IME typing.No auto-submit after IME Enter —
imeEnterRefwas already tracked inhandleEditorKeyDown, butonCompositionEnddidn't check it. Enter is consumed by IME to commit the preedit, sosubmitDraft()never fires. Users needed a second Enter.Blur doesn't reset stale composition flag — if
compositionendis missed, the wedgedcomposingRefpermanently blocks the Send button ([Bug]: Desktop app composer Enter key has no effect — cannot send messages in new or existing sessions #44135 / fix(desktop): recover from a stale IME composition flag that silently blocks all sends #44149).Fix (3 changes, 1 file:
apps/desktop/src/app/chat/composer/index.tsx)handleEditorInputcallsflushEditorToDraft()onCompositionEndauto-submits onimeEnterRefonBlurresetscomposingRefunconditionallyTesting
Related