mirror of
https://github.com/run-llama/chat-ui.git
synced 2026-07-21 11:25:22 -04:00
Race condition during IME composition #21
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BaiRuic on GitHub (Jun 15, 2025).
Problem
When using an IME for languages like Chinese, after selecting a candidate with a number key, the raw Pinyin text will be submitted instead of the final characters.
Solution
Introduce a small delay in the onCompositionEnd handler to keep isComposing as true long enough to prevent this race condition.
In ChatInputField, change:
This allows the IME to correctly finalize the text.
P.S. This is my first time submitting an issue. Please feel free to point out if I've done anything incorrectly.
@marcusschiesser commented on GitHub (Jun 16, 2025):
Cool thanks for pointing this out - you want to send a PR?