Reset state before firing onChange in SelectControl (https://github.com/woocommerce/woocommerce-admin/pull/3255)
This commit is contained in:
parent
e060fbee56
commit
81567875c0
|
@ -94,6 +94,8 @@ export class SelectControl extends Component {
|
||||||
const { query } = this.state;
|
const { query } = this.state;
|
||||||
const newSelected = multiple ? [ ...selected, option ] : [ option ];
|
const newSelected = multiple ? [ ...selected, option ] : [ option ];
|
||||||
|
|
||||||
|
this.reset( newSelected );
|
||||||
|
|
||||||
// Trigger a change if the selected value is different and pass back
|
// Trigger a change if the selected value is different and pass back
|
||||||
// an array or string depending on the original value.
|
// an array or string depending on the original value.
|
||||||
if ( Array.isArray( selected ) ) {
|
if ( Array.isArray( selected ) ) {
|
||||||
|
@ -104,8 +106,6 @@ export class SelectControl extends Component {
|
||||||
} else if ( selected !== option.key ) {
|
} else if ( selected !== option.key ) {
|
||||||
onChange( option.key, query );
|
onChange( option.key, query );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reset( newSelected );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decrementSelectedIndex() {
|
decrementSelectedIndex() {
|
||||||
|
|
Loading…
Reference in New Issue