-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[TextField] Fix first character composition issue #6456
Conversation
Tiny change. It seems to me that, when the component is conrolled, 'value' needs to be checked only in componentWillReceiveProps, and event.target.value in handleInputChange has nothing to do with hasValue state. At least, this PR can fix mui#3394 issue which, still remaining despite mui#5540, breaks 'first' character composition of CJK or other input methods when used with, for example, redux-form.
8fb8c09
to
ddc1925
Compare
@keifuji The idea behind that change looks good to me. Would you mind adding a test in case it's introducing a regression and we need to do further work? Thanks for the fix! |
Tests for uncontrolled component's hasValue state regarding event.target.value. Tests for controlled component's hasValue state reagarding value prop.
@oliviertassinari I added some tests to check hasValue state regarding event and value prop. Anyway, I found the problem has the same origin as inconsistency between state.hasValue and props.value. In fact, the question is not re-rendering but pre-rendering before it receives next props. Until then, the state rest true even though props.value is still invalid. These are logs from TextField wrapped by reduxForm:
So I included additional tests for controlled component, which will be able to prevent the issue from reappearing, and necessarily fails in the current version. |
@keifuji Thanks! |
* [TextField]Fix first character composition issue mui#3394 Tiny change. It seems to me that, when the component is conrolled, 'value' needs to be checked only in componentWillReceiveProps, and event.target.value in handleInputChange has nothing to do with hasValue state. At least, this PR can fix mui#3394 issue which, still remaining despite mui#5540, breaks 'first' character composition of CJK or other input methods when used with, for example, redux-form. * Add tests of hasValue Tests for uncontrolled component's hasValue state regarding event.target.value. Tests for controlled component's hasValue state reagarding value prop.
Tiny change. It seems to me that, when the component is conrolled,
'value' needs to be checked only in componentWillReceiveProps,
and event.target.value in handleInputChange has nothing to do with
hasValue state.
At least, this PR can fix #3394 issue which, still remaining despite #5540,
breaks 'first' character composition of CJK or other input methods
when used with, for example, redux-form.
Closes #3394.