mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
trigger change of Select after render, if value was not set to fix empty without change
This commit is contained in:
@@ -16,6 +16,14 @@ type Props = {
|
|||||||
class Select extends React.Component<Props> {
|
class Select extends React.Component<Props> {
|
||||||
field: ?HTMLSelectElement;
|
field: ?HTMLSelectElement;
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
// trigger change after render, if value is null to set it to the first value
|
||||||
|
// of the given options.
|
||||||
|
if (!this.props.value && this.field && this.field.value) {
|
||||||
|
this.props.onChange(this.field.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleInput = (event: SyntheticInputEvent<HTMLSelectElement>) => {
|
handleInput = (event: SyntheticInputEvent<HTMLSelectElement>) => {
|
||||||
this.props.onChange(event.target.value);
|
this.props.onChange(event.target.value);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user