Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition events (Chinese, Japanese IME) problem in controlled SearchInput component #849

Closed
cheton opened this issue May 11, 2024 · 0 comments · Fixed by #850
Closed
Labels
🐛 bug Something isn't working

Comments

@cheton
Copy link
Member

cheton commented May 11, 2024

Description

Chinese characters entered via the Chinese Pinyin input method trigger excessive renders, as shown below in the "Keyword Search" example:

May-08-2024 09-54-26

Note: This issue only occurred in v1. v0 does not have this problem.

Several related issues have been identified:

Resolution

To resolve this issue, it's recommended to set the value immediately for controlled input or textarea, regardless of whether it's controlled or not.

   const onChange = useCallback((e) => {
     const nextValue = ensureString(e.target.value ?? '');
-    const isControlled = (valueProp !== undefined);
-
-    if (!isControlled) {
-      setValue(nextValue);
-    }
+    setValue(nextValue);
@cheton cheton added the 🐛 bug Something isn't working label May 11, 2024
@cheton cheton closed this as completed May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
1 participant