Closed TymchenkoOleksandr closed 5 years ago
@TymchenkoOleksandr What is the use case for this? Why doesn't onSelectedChanged
work?
@BrianGenisio - need to have input value to fetch options async using input value as a filter
currently the only way to access input value is to pass custom filterOptions
function:
filterOptionsFake(options: Array<Option>, inputValue: string): Array<Option> {
this.setState(state => (inputValue === state.inputValue ? null : { inputValue }));
return options;
}
but this approach causes errors:
Sorry about the late reply, you got me right before I left for vacation and I didn't communicate that. I'm still on vacation, but wanted to give some thoughts. I'm thinking of it from an interface perspective... exposing an event from the input feels like a leaky abstraction to me, and adds another property. What if options received an optional function instead? That function would return Options or a promise to the Options.
type Options = Array<Option>;
type OptionsFn = (filter: string) => Options | Promise<Options>;
type Props = {
options: Options | OptionsFn,
// the rest of the props
};
If we did this, it would probably make filterOptions
obsolete, so I might want to deprecate that in a future, Major (semver) update.
Thoughts?
completely agree
@TymchenkoOleksandr Is this something you are working on? (updating your diff?) I'm just getting back from vacation, so it may be several days (as I catch up with work messages) before I can look at this, but I'm happy to if you're patient.
@BrianGenisio , currently i do not work on updating this diff
@BrianGenisio , have a look, please