Style Book: Fix Featured Product and Featured Category Blocks preview (https://github.com/woocommerce/woocommerce-blocks/pull/8313)
* Subscribe only to changes on core/block-editor * Improve performance of useForcedLayou This is because by the time we reach this line, innerBlocks will be an empty array (or we wouldn't make it this far) and if nextBlocks contains ANY items it will, by definition be unequal, so a length check is simpler and more performant. Also we can remove the dependence on yet another lodash function by doing it this way. * Check if templates synced before doing it again in useForcedLayout * Style Book: Fix Featured Product and Featured Category Blocks Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com> Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
This commit is contained in:
parent
5fc14d42a0
commit
c02726e1c1
|
@ -80,6 +80,7 @@
|
|||
"default": 500
|
||||
},
|
||||
"linkText": {
|
||||
"default": "Shop now",
|
||||
"type": "string"
|
||||
},
|
||||
"categoryId": {
|
||||
|
|
|
@ -8,6 +8,7 @@ type ExampleBlock = Block[ 'example' ] & {
|
|||
attributes: {
|
||||
categoryId: 'preview' | number;
|
||||
previewCategory: typeof previewCategories[ number ];
|
||||
editMode: false;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -15,5 +16,6 @@ export const example: ExampleBlock = {
|
|||
attributes: {
|
||||
categoryId: 'preview',
|
||||
previewCategory: previewCategories[ 0 ],
|
||||
editMode: false,
|
||||
},
|
||||
} as const;
|
||||
|
|
|
@ -8,6 +8,7 @@ type ExampleBlock = Block[ 'example' ] & {
|
|||
attributes: {
|
||||
productId: 'preview' | number;
|
||||
previewProduct: typeof previewProducts[ number ];
|
||||
editMode: false;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -15,5 +16,6 @@ export const example: ExampleBlock = {
|
|||
attributes: {
|
||||
productId: 'preview',
|
||||
previewProduct: previewProducts[ 0 ],
|
||||
editMode: false,
|
||||
},
|
||||
} as const;
|
||||
|
|
|
@ -116,7 +116,7 @@ export function register(
|
|||
...DEFAULT_SETTINGS,
|
||||
example: {
|
||||
...DEFAULT_EXAMPLE,
|
||||
example,
|
||||
...example,
|
||||
},
|
||||
/**
|
||||
* Renders and manages the block.
|
||||
|
|
Loading…
Reference in New Issue