You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed what may be considered a bug in Creatable. It's not necessarily a bug as I suppose the code is doing what it should be, but the implementation is slightly confusing and caught me off guard.
When using Creatable with the onInputChange prop, if the prop func returns nothing, the the prompTextCreator doesn't "work". the code at line 119 in Creatable.js sets this.inputValue to the result of onInputChange. When nothing is returned, the value is set to undefined. When promptTextCreator tries to run, it sees only undefined and not what is currently written in the field.
onInputChange(input){const{ onInputChange }=this.props;// This value may be needed in between Select mounts (when this.select is null)this.inputValue=input;if(onInputChange){this.inputValue=onInputChange(input)||this.inputValue;// fix is here}returnthis.inputValue;}
I haven't tested this yet but I imagine this addresses the issue.
While this may not be a bug as such, it might be a nice quality-of-life thing, as it took me a while to find out why it suddenly wasn't working.
The text was updated successfully, but these errors were encountered:
I've noticed what may be considered a bug in Creatable. It's not necessarily a bug as I suppose the code is doing what it should be, but the implementation is slightly confusing and caught me off guard.
When using Creatable with the onInputChange prop, if the prop func returns nothing, the the prompTextCreator doesn't "work". the code at line 119 in Creatable.js sets
this.inputValue
to the result ofonInputChange
. When nothing is returned, the value is set to undefined. When promptTextCreator tries to run, it sees only undefined and not what is currently written in the field.I've created an example at StackBlitz.
my proposal is to change line 119 (v1.2.1):
I haven't tested this yet but I imagine this addresses the issue.
While this may not be a bug as such, it might be a nice quality-of-life thing, as it took me a while to find out why it suddenly wasn't working.
The text was updated successfully, but these errors were encountered: