Switch productType to postType in context augmentation
This commit is contained in:
parent
46140f18b9
commit
b40f9d2035
|
@ -16,14 +16,14 @@ interface BlockRepresentation< T extends Record< string, object > > {
|
|||
}
|
||||
|
||||
function useEvaluationContext( context: Record< string, unknown > ) {
|
||||
const { productType } = context;
|
||||
const { postType } = context;
|
||||
|
||||
const productId = useEntityId( 'postType', productType );
|
||||
const productId = useEntityId( 'postType', postType );
|
||||
|
||||
const getEvaluationContext = ( select: typeof WPSelect ) => {
|
||||
const editedProduct = select( 'core' ).getEditedEntityRecord(
|
||||
'postType',
|
||||
productType,
|
||||
postType,
|
||||
productId
|
||||
);
|
||||
|
||||
|
@ -41,7 +41,7 @@ function useEvaluationContext( context: Record< string, unknown > ) {
|
|||
function augmentUsesContext( usesContext?: string[] ) {
|
||||
// Note: If you modify this function, also update the server-side
|
||||
// Automattic\WooCommerce\Admin\Features\ProductBlockEditor\BlockRegistry::augment_uses_context() function.
|
||||
return [ ...( usesContext || [] ), 'productType' ];
|
||||
return [ ...( usesContext || [] ), 'postType' ];
|
||||
}
|
||||
|
||||
export function registerProductEditorBlockType<
|
||||
|
|
|
@ -164,7 +164,7 @@ class BlockRegistry {
|
|||
return array_merge(
|
||||
isset( $uses_context ) ? $uses_context : [],
|
||||
[
|
||||
'productType',
|
||||
'postType',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue