[Product Block Editor]: when adding a new attribute, show selected item right after user clicks on it (#46713)
* render selected value before porpulate terms * changelog
This commit is contained in:
parent
ea27c1f364
commit
2df389329e
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
[Product Block Editor]: when adding a new attribute, show selected item right after user clicks on it
|
|
@ -237,6 +237,15 @@ export const NewAttributeModal: React.FC< NewAttributeModalProps > = ( {
|
|||
value &&
|
||||
! ( typeof value === 'string' )
|
||||
) {
|
||||
const selectedAttribute =
|
||||
getProductAttributeObject(
|
||||
value
|
||||
) as EnhancedProductAttribute;
|
||||
|
||||
setValue( 'attributes[' + index + ']', {
|
||||
...selectedAttribute,
|
||||
} );
|
||||
|
||||
resolveSelect(
|
||||
EXPERIMENTAL_PRODUCT_ATTRIBUTE_TERMS_STORE_NAME
|
||||
)
|
||||
|
@ -250,10 +259,6 @@ export const NewAttributeModal: React.FC< NewAttributeModalProps > = ( {
|
|||
attribute_id: value.id,
|
||||
} )
|
||||
.then( ( terms ) => {
|
||||
const selectedAttribute =
|
||||
getProductAttributeObject(
|
||||
value
|
||||
) as EnhancedProductAttribute;
|
||||
if ( termsAutoSelection === 'all' ) {
|
||||
selectedAttribute.terms = terms;
|
||||
} else if ( terms.length > 0 ) {
|
||||
|
|
Loading…
Reference in New Issue